-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
37 lines (27 loc) · 961 Bytes
/
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
# From: https://docs.docker.com/samples/rails/
FROM ruby:2.7 AS base
ARG TARGET_APP='app'
ARG TARGET_DIR='.'
RUN curl -sL https://deb.nodesource.com/setup_14.x > /tmp/setup_node.sh && \
# Validate node repo setup script.
sha256sum /tmp/setup_node.sh | grep 597d9b16bca9b8061f23b34933b522267d18f5dff75de3c09a1fad2709f69f16 && \
echo "sha matches!" || echo "sha fails!"
RUN bash /tmp/setup_node.sh && \
apt-get update -qq && \
apt-get install -y nodejs postgresql-client && \
gem install rails
WORKDIR /$TARGET_APP
COPY $TARGET_DIR/ /$TARGET_APP/
# Add a script to be executed to run service.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
FROM base as dev
RUN npm install --global yarn
# When bootstrapping from fresh, this will fail.
RUN bundle install || true
FROM base AS prod
RUN bundle install
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Service that runs on container launch.
CMD ["rails", "server", "-b", "0.0.0.0"]