-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Dockerfile
64 lines (48 loc) · 1.7 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This Dockerfile uses a multi-stage build.
# https://docs.docker.com/engine/userguide/eng-image/multistage-build
### BASE ENVIRONMENT STAGE ###
FROM ruby:3.2.4-slim as base
LABEL maintainer="enviroDGI@gmail.com"
# Install apt based dependencies required to run Rails as
# well as RubyGems. As the Ruby image itself is based on a
# Debian image, we use apt-get to install those.
RUN apt-get update && apt-get install -y \
build-essential \
nodejs \
libpq-dev
# Configure the main working directory. This is the base
# directory used in any further RUN, COPY, and ENTRYPOINT
# commands.
RUN mkdir -p /app
WORKDIR /app
# Copy the Gemfile as well as the Gemfile.lock and install
# the RubyGems. This is a separate step so the dependencies
# will be cached unless changes to one of those two files
# are made.
COPY Gemfile Gemfile.lock ./
RUN gem install bundler && bundle install --jobs 20 --retry 5
# Copy the main application.
COPY . ./
### IMPORT WORKER TARGET ###
FROM base as import-worker
LABEL maintainer="enviroDGI@gmail.com"
WORKDIR /app
CMD ["bundle", "exec", "good_job", "start"]
### RAILS SERVER TARGET ###
FROM base as rails-server
LABEL maintainer="enviroDGI@gmail.com"
WORKDIR /app
# Expose port 3000 to the Docker host, so we can access it
# from the outside.
EXPOSE 3000
# Pre-compile static assets.
RUN bundle exec rake assets:precompile
# The main command to run when the container starts. Also
# tell the Rails dev server to bind to all interfaces by
# default.
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
### STATUS UPDATE JOB TARGET ###
FROM base as status-update-job
LABEL maintainer="enviroDGI@gmail.com"
WORKDIR /app
CMD ["bundle", "exec", "rake", "update_page_statuses"]