-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
43 lines (32 loc) · 1.37 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
# Use the specific Ruby version as the parent image
FROM ruby:3.2.2
# Install nodejs and yarn (used for webpacker and asset compilation)
RUN apt-get update -qq && apt-get install -y nodejs sqlite3
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y yarn
# Set the working directory in the container to /app
WORKDIR /app
ENV BUNDLER_VERSION='2.4.13'
RUN gem install bundler -v ${BUNDLER_VERSION}
# Add Gemfile and Gemfile.lock to the /app directory in the docker container
COPY Gemfile Gemfile.lock ./
# Install any needed packages specified in Gemfile
ARG BUNDLE_GEMFILE=Gemfile
ENV BUNDLE_GEMFILE=${BUNDLE_GEMFILE}
RUN bundle config --global github.https true && \
bundle config force_ruby_platform true && \
bundle install -j $(nproc) --retry 5 && \
rm -rf /usr/local/bundle/cache/*.gem \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
# Copy the current directory contents into the container at /app
COPY . .
# Add a script to be executed every time the container starts.
COPY app.sh /usr/bin/
RUN chmod +x /usr/bin/app.sh
ENTRYPOINT ["app.sh"]
# Expose port 3000 for the API
EXPOSE 3000
# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]