-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (30 loc) · 835 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (30 loc) · 835 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
39
# Rails 7.0.0 compatible Ruby
FROM ruby:3.0.6
# Install system dependencies
RUN apt-get update -y && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Node 18 (required for esbuild / Hotwire)
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn
# Set working directory
WORKDIR /app
# Ensure gem binaries are on PATH
ENV PATH="/usr/local/bundle/bin:${PATH}"
# Install Ruby gems
COPY Gemfile Gemfile.lock ./
RUN bundle install
# Install JS dependencies
COPY package.json yarn.lock ./
RUN yarn install
# Copy the rest of the app
COPY . .
# Rails defaults
ENV RAILS_ENV=development
EXPOSE 3000
# Start Rails (no daemonisation)
CMD ["bin/rails", "server", "-b", "0.0.0.0"]