Dockerfile for production
This commit is contained in:
parent
03256d28dd
commit
fa32fc9229
2 changed files with 15 additions and 25 deletions
32
Dockerfile
32
Dockerfile
|
@ -1,40 +1,22 @@
|
||||||
# Based on ruby image, packed with a lot of development dependencies
|
|
||||||
FROM ruby:2.3
|
FROM ruby:2.3
|
||||||
|
|
||||||
# Install all dependencies for development and testing
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install --no-install-recommends -y \
|
apt-get install --no-install-recommends -y \
|
||||||
mysql-client \
|
cron \
|
||||||
libv8-dev \
|
libv8-dev \
|
||||||
libmagic-dev \
|
libmagic-dev \
|
||||||
libmysqlclient-dev \
|
libmysqlclient-dev && \
|
||||||
xvfb \
|
|
||||||
iceweasel && \
|
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
apt-get clean
|
apt-get clean
|
||||||
|
|
||||||
# Run app and all commands as user 'app'. This avoids changing permissions
|
ENV RAILS_ENV=production
|
||||||
# for files in mounted volume.
|
|
||||||
RUN adduser --gecos GECOS --disabled-password --shell /bin/bash app
|
|
||||||
USER app
|
|
||||||
|
|
||||||
# Create an directory to store the application code.
|
WORKDIR /usr/src/app
|
||||||
RUN mkdir /home/app/src
|
|
||||||
WORKDIR /home/app/src
|
|
||||||
|
|
||||||
# Copy plugins before the rest to allow bundler loading gemspecs
|
|
||||||
# TODO: Move plugins to gems and add them to Gemfile instead
|
|
||||||
COPY plugins ./plugins
|
|
||||||
|
|
||||||
# Add Gemfiles and run bundle.
|
|
||||||
COPY Gemfile Gemfile.lock ./
|
|
||||||
ENV BUNDLE_JOBS=4 BUNDLE_PATH=/home/app/bundle \
|
|
||||||
BUNDLE_APP_CONFIG=/home/app/bundle/config
|
|
||||||
RUN bundle install
|
|
||||||
|
|
||||||
# Copy the application code. (Excluded files see .dockerignore)
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
RUN bundle install --without development --without test && \
|
||||||
|
whenever --update-crontab
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||||
CMD ["rails", "server", "--binding", "0.0.0.0"]
|
CMD ["rails", "server", "--binding", "0.0.0.0"]
|
||||||
|
|
8
docker-entrypoint.sh
Executable file
8
docker-entrypoint.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -f tmp/pids/server.pid ]; then
|
||||||
|
rm tmp/pids/server.pid
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
Loading…
Reference in a new issue