1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00
fab-manager/Dockerfile

109 lines
3.2 KiB
Docker
Raw Normal View History

2022-05-04 10:36:57 +02:00
FROM ruby:2.6.10-alpine
2020-11-25 11:39:53 +01:00
MAINTAINER contact@fab-manager.com
2016-03-23 18:39:41 +01:00
RUN addgroup --gid 1000 fabmanager && \
adduser --uid 1000 -G fabmanager -s /bin/bash -D fabmanager
# Install upgrade system packages
RUN apk update && apk upgrade && \
# Install runtime apk dependencies
apk add --update \
bash \
curl \
2016-03-23 18:39:41 +01:00
nodejs \
yarn \
git \
openssh \
imagemagick \
2018-11-22 17:09:14 +01:00
supervisor \
tzdata \
libc-dev \
ruby-dev \
zlib-dev \
xz-dev \
postgresql-dev \
postgresql-client \
libxml2-dev \
libxslt-dev \
libsass-dev \
libsass \
libc6-compat \
libidn-dev && \
# Install buildtime apk dependencies
apk add --update --no-cache --virtual .build-deps \
alpine-sdk \
build-base \
linux-headers \
patch
# Fix bug: LoadError: Could not open library '/usr/local/bundle/gems/sassc-2.1.0-x86_64-linux/lib/sassc/libsass.so': Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/local/bundle/gems/sassc-2.1.0-x86_64-linux/lib/sassc/libsass.so)
# add libsass-dev libsass libc6-compat and env below
ENV LD_LIBRARY_PATH=/lib64
RUN gem install bundler
# Throw error if Gemfile has been modified since Gemfile.lock
2016-03-23 18:39:41 +01:00
RUN bundle config --global frozen 1
# Install gems in a cache efficient way
2016-03-23 18:39:41 +01:00
WORKDIR /tmp
COPY Gemfile /tmp/
COPY Gemfile.lock /tmp/
RUN bundle config set --local without 'development test doc' && bundle install && bundle binstubs --all
2016-03-23 18:39:41 +01:00
# Prepare the application directory
RUN mkdir -p /usr/src/app && chown -R fabmanager:fabmanager /usr/src/app
# Change to non-root user
USER fabmanager
# Install Javascript packages
WORKDIR /usr/src/app
COPY package.json /usr/src/app/package.json
COPY yarn.lock /usr/src/app/yarn.lock
RUN yarn install
2018-11-22 17:09:14 +01: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
RUN mkdir -p /usr/src/app/config && \
2019-06-26 12:58:53 +02:00
mkdir -p /usr/src/app/invoices && \
mkdir -p /usr/src/app/payment_schedules && \
2019-06-26 12:58:53 +02:00
mkdir -p /usr/src/app/exports && \
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 && \
2020-10-05 17:56:30 +02:00
mkdir -p /usr/src/app/public/packs && \
2019-06-26 12:58:53 +02:00
mkdir -p /usr/src/app/accounting && \
mkdir -p /usr/src/app/proof_of_identity_files && \
2019-06-26 12:58:53 +02:00
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
VOLUME /usr/src/app/payment_schedules
2016-07-27 17:48:15 +02:00
VOLUME /usr/src/app/exports
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
2020-10-05 17:56:30 +02:00
VOLUME /usr/src/app/public/packs
VOLUME /usr/src/app/accounting
VOLUME /usr/src/app/proof_of_identity_files
2016-03-23 18:39:41 +01:00
VOLUME /var/log/supervisor
# 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
# 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
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/fablab.conf"]