Improve Docker setup
This commit is contained in:
parent
425d66e67a
commit
ccb8b47e6e
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Remove a potentially pre-existing server.pid for Rails.
|
||||||
|
rm -f /app/tmp/pids/server.pid
|
||||||
|
|
||||||
|
# Then exec the container's main process (what's set as CMD in the Dockerfile).
|
||||||
|
exec "$@"
|
|
@ -1,30 +1,26 @@
|
||||||
FROM ruby:2.7
|
FROM ruby:2.7
|
||||||
|
|
||||||
RUN apt-get update -qq && apt-get install -y build-essential
|
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
|
||||||
|
|
||||||
# for postgres
|
RUN apt-get update -qq && \
|
||||||
RUN apt-get install -y libpq-dev
|
apt-get install -y --no-install-recommends build-essential \
|
||||||
|
libpq-dev postgresql-client \
|
||||||
|
libxml2-dev libxslt1-dev \
|
||||||
|
libmagickwand-dev imagemagick \
|
||||||
|
nodejs
|
||||||
|
|
||||||
# for nokogiri
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
RUN apt-get install -y libxml2-dev libxslt1-dev
|
|
||||||
|
|
||||||
# for images
|
RUN mkdir /app
|
||||||
RUN apt-get install -y libmagickwand-dev imagemagick
|
WORKDIR /app
|
||||||
|
|
||||||
# for a JS runtime
|
ADD Gemfile* /app/
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
|
|
||||||
RUN apt-get install -y nodejs
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
postgresql-client \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENV APP_HOME /app
|
|
||||||
RUN mkdir $APP_HOME
|
|
||||||
WORKDIR $APP_HOME
|
|
||||||
|
|
||||||
ADD Gemfile* $APP_HOME/
|
|
||||||
RUN bundle install
|
RUN bundle install
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
COPY .docker/entrypoint.sh /usr/bin/
|
||||||
|
RUN chmod +x /usr/bin/entrypoint.sh
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["rails", "server", "-b", "0.0.0.0"]
|
|
@ -2,12 +2,11 @@ version: "3.7"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: .docker/ruby/Dockerfile
|
dockerfile: .docker/ruby/Dockerfile
|
||||||
command:
|
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
|
||||||
ruby bin/rails server --port 3000 --binding 0.0.0.0
|
depends_on:
|
||||||
links:
|
|
||||||
- postgres
|
- postgres
|
||||||
- redis
|
- redis
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in New Issue