-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile-Node
27 lines (19 loc) · 966 Bytes
/
Dockerfile-Node
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
# Defaults to the latest Ruby, add ":version" e.g "ruby:3.2.1" to specify
FROM ruby
# Install node and yarn. To choose a different node version change "18.x" e.g "16.x"
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update -qq && apt-get install -y build-essential yarn --no-install-recommends && \
rm -rf ./var/lib/apt/lists/*
# Copy the Gemfile and cache the gems. This prevents changes to the source
# from reinstalling gems when the container is rebuild.
WORKDIR /usr/src/app
COPY Gemfile* /usr/src/app/
ENV BUNDLE_PATH /gems
RUN bundle install --jobs 10 --retry 5
# Copy source files
COPY . /usr/src/app/
# Start Rails server, "-b 0.0.0.0" is needed to make it accessable outside
# of the container
CMD ["bin/rails", "s", "-b", "0.0.0.0"]