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
|
||||
|
||||
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 install -y libpq-dev
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install -y --no-install-recommends build-essential \
|
||||
libpq-dev postgresql-client \
|
||||
libxml2-dev libxslt1-dev \
|
||||
libmagickwand-dev imagemagick \
|
||||
nodejs
|
||||
|
||||
# for nokogiri
|
||||
RUN apt-get install -y libxml2-dev libxslt1-dev
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# for images
|
||||
RUN apt-get install -y libmagickwand-dev imagemagick
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
# for a JS runtime
|
||||
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/
|
||||
ADD Gemfile* /app/
|
||||
RUN bundle install
|
||||
COPY . /app
|
||||
|
||||
COPY .docker/entrypoint.sh /usr/bin/
|
||||
RUN chmod +x /usr/bin/entrypoint.sh
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["rails", "server", "-b", "0.0.0.0"]
|
|
@ -5,9 +5,8 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: .docker/ruby/Dockerfile
|
||||
command:
|
||||
ruby bin/rails server --port 3000 --binding 0.0.0.0
|
||||
links:
|
||||
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
environment:
|
||||
|
|
Loading…
Reference in New Issue