Updated Docker setup.
* Use ruby version 3 * Use bundle container * Run rails commands as app user
This commit is contained in:
parent
6d338ffa9e
commit
0bdeaa1570
3 changed files with 37 additions and 33 deletions
37
Dockerfile
37
Dockerfile
|
|
@ -1,39 +1,38 @@
|
|||
FROM ruby:2.1-slim
|
||||
# Based on ruby image, packed with a lot of development dependencies
|
||||
FROM ruby:2.3
|
||||
|
||||
# Install all dependencies for development and testing
|
||||
RUN apt-get update && \
|
||||
apt-get install --no-install-recommends -y \
|
||||
mysql-client \
|
||||
git \
|
||||
make \
|
||||
gcc \
|
||||
g++ \
|
||||
patch \
|
||||
libsqlite3-dev \
|
||||
libv8-dev \
|
||||
libmysqlclient-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
libffi-dev \
|
||||
libreadline-dev \
|
||||
xvfb \
|
||||
iceweasel && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
apt-get clean
|
||||
|
||||
ENV WORKDIR /usr/src/app
|
||||
# Run app and all commands as user 'app'. This avoids changing permissions
|
||||
# for files in mounted volume.
|
||||
RUN adduser --gecos GECOS --disabled-password --shell /bin/bash app
|
||||
USER app
|
||||
|
||||
RUN mkdir -p $WORKDIR
|
||||
WORKDIR $WORKDIR
|
||||
# Create an directory to store the application code.
|
||||
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 $WORKDIR/plugins
|
||||
COPY plugins ./plugins
|
||||
|
||||
COPY Gemfile $WORKDIR/
|
||||
COPY Gemfile.lock $WORKDIR/
|
||||
RUN bundle install --jobs 4
|
||||
# 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 . $WORKDIR
|
||||
# Copy the application code. (Excluded files see .dockerignore)
|
||||
COPY . ./
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue