greenlight/Dockerfile
Martin Beckmann 760b80ae9a
Update Dockerfile (#2620)
--> 1a625c70ad (r48758847)

---

 mantridereso yesterday

I think it's necessary to add 'shared-mime-info' package at this position as well:

`
############### Build step done ###############

FROM ruby:2.7.2-alpine
Set a variable for the install location.

ARG RAILS_ROOT=/usr/src/app
ARG PACKAGES="tzdata curl postgresql-client sqlite-libs yarn nodejs bash shared-mime-info"

ENV RAILS_ENV=production
ENV BUNDLE_APP_CONFIG="$RAILS_ROOT/.bundle"
`
Otherwise presentation preupload fails, as /usr/share/mime/packages/freedesktop.org.xml isn't available in container.
@jfederico
jfederico yesterday Author Member

Yeah, that is right. The gem is passed but the dependency is still required
2021-03-28 12:47:39 -04:00

66 lines
1.7 KiB
Docker

FROM ruby:2.7.2-alpine AS base
# Set a variable for the install location.
ARG RAILS_ROOT=/usr/src/app
# Set Rails environment.
ENV RAILS_ENV production
ENV BUNDLE_APP_CONFIG="$RAILS_ROOT/.bundle"
# Make the directory and set as working.
RUN mkdir -p $RAILS_ROOT
WORKDIR $RAILS_ROOT
ARG BUILD_PACKAGES="build-base curl-dev git shared-mime-info"
ARG DEV_PACKAGES="postgresql-dev sqlite-libs sqlite-dev yaml-dev zlib-dev nodejs yarn"
ARG RUBY_PACKAGES="tzdata"
# Install app dependencies.
RUN apk update \
&& apk upgrade \
&& apk add --update --no-cache $BUILD_PACKAGES $DEV_PACKAGES $RUBY_PACKAGES
COPY Gemfile* ./
COPY Gemfile Gemfile.lock $RAILS_ROOT/
RUN bundle config --global frozen 1 \
&& bundle install --deployment --without development:test:assets -j4 --path=vendor/bundle \
&& rm -rf vendor/bundle/ruby/2.7.0/cache/*.gem \
&& find vendor/bundle/ruby/2.7.0/gems/ -name "*.c" -delete \
&& find vendor/bundle/ruby/2.7.0/gems/ -name "*.o" -delete
# Adding project files.
COPY . .
# Remove folders not needed in resulting image
RUN rm -rf tmp/cache spec
############### Build step done ###############
FROM ruby:2.7.2-alpine
# Set a variable for the install location.
ARG RAILS_ROOT=/usr/src/app
ARG PACKAGES="tzdata curl postgresql-client sqlite-libs yarn nodejs bash shared-mime-info"
ENV RAILS_ENV=production
ENV BUNDLE_APP_CONFIG="$RAILS_ROOT/.bundle"
WORKDIR $RAILS_ROOT
RUN apk update \
&& apk upgrade \
&& apk add --update --no-cache $PACKAGES
COPY --from=base $RAILS_ROOT $RAILS_ROOT
# Expose port 80.
EXPOSE 80
# Sets the footer of greenlight application with current build version
ARG version_code
ENV VERSION_CODE=$version_code
# Start the application.
CMD ["bin/start"]