-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (26 loc) · 1011 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
# Use the official Ruby image as the base image
FROM ruby:3.1
# Install Node.js and Yarn
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
&& curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/yarn-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] 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 libpq-dev nodejs yarn
# Set the working directory
WORKDIR /app
# Copy the Gemfile and Gemfile.lock
COPY Gemfile* ./
# Install gems
RUN bundle install
# Compile assets
RUN rails assets:precompile
# Copy the package.json and yarn.lock
COPY package.json yarn.lock ./
# Install JavaScript dependencies
RUN yarn install --check-files
# Copy the rest of the application
COPY . .
# Expose the port the app runs on
EXPOSE 3000
# Start the application
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]