Skip to content
Snippets Groups Projects
Commit 5ad1aae7 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

support for production and dev deployment processes

parent d7fc11a8
No related tags found
No related merge requests found
Pipeline #8332 failed
......@@ -8,6 +8,9 @@
version: '3'
services:
app:
build:
dockerfile: Dockerfile.development
fcrepodb:
restart: "no"
......@@ -26,6 +29,8 @@ services:
restart: "no"
web:
build:
dockerfile: Dockerfile.development
environment:
- RAILS_FORCE_SSL=false
volumes:
......@@ -35,6 +40,8 @@ services:
restart: "no"
workers:
build:
dockerfile: Dockerfile.development
volumes:
- ./hyrax:/data:cached
restart: "no"
......
FROM ruby:2.7.8-alpine
# Setup build variables
ARG RAILS_ENV
ARG DERIVATIVES_PATH
ARG UPLOADS_PATH
ARG CACHE_PATH
ARG FITS_VERSION
ENV APP_PRODUCTION=/data/
# Add backports to apt-get sources
# Install libraries, dependencies, java and fits
RUN apk update && \
apk upgrade && \
apk add bash build-base curl curl-dev gcompat imagemagick imagemagick-libs imagemagick-dev libarchive-tools \
libpq-dev libxml2-dev libxslt-dev nodejs openjdk11-jre-headless sqlite-dev tzdata yarn
COPY policy.xml /etc/ImageMagick-7/policy.xml
RUN mkdir -p /fits/fits-$FITS_VERSION \
&& curl --fail --location "https://github.com/harvard-lts/fits/releases/download/$FITS_VERSION/fits-$FITS_VERSION.zip" | bsdtar --extract --directory /fits/fits-$FITS_VERSION \
&& chmod +x "/fits/fits-$FITS_VERSION/fits.sh" "/fits/fits-$FITS_VERSION/fits-env.sh" "/fits/fits-$FITS_VERSION/fits-ngserver.sh"
# copy gemfiles to production folder
COPY Gemfile Gemfile.lock $APP_PRODUCTION
# install gems to system - use flags dependent on RAILS_ENV
RUN cd $APP_PRODUCTION \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle install --without production --no-deployment \
&& mv Gemfile.lock Gemfile.lock.built_by_docker
# create a folder to store derivatives, file uploads and cache directory
RUN mkdir -p $DERIVATIVES_PATH
RUN mkdir -p $UPLOADS_PATH
RUN mkdir -p $CACHE_PATH
# copy the application
COPY . $APP_PRODUCTION
# use the just built Gemfile.lock, not the one copied into the container and verify the gems are correctly installed
RUN cd $APP_PRODUCTION \
&& mv Gemfile.lock.built_by_docker Gemfile.lock \
&& bundle check
# generate production assets if production environment
RUN if [ ! -f "/data/yarn.lock" ]; then \
yarn install; \
fi
COPY docker-entrypoint.sh /bin/
WORKDIR $APP_PRODUCTION
RUN chmod +x /bin/docker-entrypoint.sh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment