-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (29 loc) · 902 Bytes
/
Dockerfile
File metadata and controls
38 lines (29 loc) · 902 Bytes
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
FROM ruby:3.2.2
# Install Node.js 21.5.0
ENV NODE_VERSION=21.5.0
RUN curl -fsSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz -o node.tar.xz && \
tar -xJf node.tar.xz -C /usr/local --strip-components=1 && \
rm node.tar.xz && \
npm install -g yarn
RUN apt-get update -qq && apt-get install -y \
postgresql-client \
build-essential \
libpq-dev \
redis-tools \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy Gemfile and install gems
COPY Gemfile Gemfile.lock ./
RUN bundle install
# Copy package.json and install node modules
COPY package.json yarn.lock ./
RUN yarn install
# Copy the application code
COPY . .
# Precompile assets
RUN bundle exec rails assets:precompile
# Expose port 3000
EXPOSE 3000
# Start Rails server
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0", "-e", "production"]