2020-05-18 10:28:30 +02:00
|
|
|
FROM ruby:2.6.5-alpine
|
2016-03-23 18:39:41 +01:00
|
|
|
MAINTAINER peng@sleede.com
|
|
|
|
|
2019-09-12 01:38:20 +02:00
|
|
|
# Install upgrade system packages
|
|
|
|
RUN apk update && apk upgrade && \
|
|
|
|
# Install runtime apk dependencies
|
2019-09-23 08:57:02 +02:00
|
|
|
apk add --update \
|
|
|
|
bash \
|
|
|
|
curl \
|
2016-03-23 18:39:41 +01:00
|
|
|
nodejs \
|
2019-09-12 01:38:20 +02:00
|
|
|
yarn \
|
|
|
|
imagemagick \
|
2018-11-22 17:09:14 +01:00
|
|
|
supervisor \
|
2019-09-12 01:38:20 +02:00
|
|
|
tzdata \
|
|
|
|
libc-dev \
|
|
|
|
ruby-dev \
|
|
|
|
zlib-dev \
|
|
|
|
xz-dev \
|
|
|
|
postgresql-dev \
|
2020-06-29 10:54:42 +02:00
|
|
|
postgresql-client \
|
2019-09-12 01:38:20 +02:00
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
|
|
|
libidn-dev && \
|
|
|
|
# Install buildtime apk dependencies
|
2019-09-23 08:57:02 +02:00
|
|
|
apk add --update --no-cache --virtual .build-deps \
|
|
|
|
alpine-sdk \
|
2019-09-12 01:38:20 +02:00
|
|
|
build-base \
|
|
|
|
linux-headers \
|
|
|
|
git \
|
|
|
|
patch
|
|
|
|
|
2020-05-18 11:08:06 +02:00
|
|
|
RUN gem install bundler
|
|
|
|
|
2019-09-12 01:38:20 +02:00
|
|
|
# Throw error if Gemfile has been modified since Gemfile.lock
|
2016-03-23 18:39:41 +01:00
|
|
|
RUN bundle config --global frozen 1
|
|
|
|
|
2019-09-12 01:38:20 +02:00
|
|
|
# Install gems in a cache efficient way
|
2016-03-23 18:39:41 +01:00
|
|
|
WORKDIR /tmp
|
|
|
|
COPY Gemfile /tmp/
|
|
|
|
COPY Gemfile.lock /tmp/
|
2019-09-12 01:38:20 +02:00
|
|
|
RUN bundle install --binstubs --without development test doc
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2019-09-12 01:38:20 +02:00
|
|
|
# Install Javascript packages
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY package.json /usr/src/app/package.json
|
|
|
|
COPY yarn.lock /usr/src/app/yarn.lock
|
2020-03-23 16:15:06 +01:00
|
|
|
RUN yarn install --production
|
2018-11-22 17:09:14 +01:00
|
|
|
|
2019-09-12 01:38:20 +02:00
|
|
|
# Clean up build deps, cached packages and temp files
|
|
|
|
RUN apk del .build-deps && \
|
|
|
|
yarn cache clean && \
|
|
|
|
rm -rf /tmp/* \
|
|
|
|
/var/tmp/* \
|
|
|
|
/var/cache/apk/* \
|
|
|
|
/usr/lib/ruby/gems/*/cache/*
|
2016-03-23 18:39:41 +01:00
|
|
|
|
|
|
|
# Web app
|
2019-06-26 12:58:53 +02:00
|
|
|
RUN mkdir -p /usr/src/app && \
|
|
|
|
mkdir -p /usr/src/app/config && \
|
|
|
|
mkdir -p /usr/src/app/invoices && \
|
|
|
|
mkdir -p /usr/src/app/exports && \
|
2019-09-24 17:42:50 +02:00
|
|
|
mkdir -p /usr/src/app/imports && \
|
2019-06-26 12:58:53 +02:00
|
|
|
mkdir -p /usr/src/app/log && \
|
|
|
|
mkdir -p /usr/src/app/public/uploads && \
|
|
|
|
mkdir -p /usr/src/app/public/assets && \
|
|
|
|
mkdir -p /usr/src/app/accounting && \
|
|
|
|
mkdir -p /usr/src/app/tmp/sockets && \
|
|
|
|
mkdir -p /usr/src/app/tmp/pids
|
2016-03-23 18:39:41 +01:00
|
|
|
|
|
|
|
COPY docker/database.yml /usr/src/app/config/database.yml
|
|
|
|
COPY . /usr/src/app
|
|
|
|
|
|
|
|
# Volumes
|
|
|
|
VOLUME /usr/src/app/invoices
|
2016-07-27 17:48:15 +02:00
|
|
|
VOLUME /usr/src/app/exports
|
2019-09-24 17:42:50 +02:00
|
|
|
VOLUME /usr/src/app/imports
|
2016-09-06 12:19:47 +02:00
|
|
|
VOLUME /usr/src/app/public
|
2016-03-23 18:39:41 +01:00
|
|
|
VOLUME /usr/src/app/public/uploads
|
|
|
|
VOLUME /usr/src/app/public/assets
|
2019-01-10 10:52:29 +01:00
|
|
|
VOLUME /usr/src/app/accounting
|
2016-03-23 18:39:41 +01:00
|
|
|
VOLUME /var/log/supervisor
|
|
|
|
|
2019-09-12 01:38:20 +02:00
|
|
|
# Expose port 3000 to the Docker host, so we can access it from the outside
|
2016-09-06 12:19:47 +02:00
|
|
|
EXPOSE 3000
|
2016-03-23 18:39:41 +01:00
|
|
|
|
2019-09-12 01:38:20 +02:00
|
|
|
# The main command to run when the container starts. Also tell the Rails server
|
|
|
|
# to bind to all interfaces by default.
|
2016-03-23 18:39:41 +01:00
|
|
|
COPY docker/supervisor.conf /etc/supervisor/conf.d/fablab.conf
|
2019-09-12 01:38:20 +02:00
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/fablab.conf"]
|