-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
55 lines (45 loc) · 1.04 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
44
45
46
47
48
49
50
51
52
53
54
55
FROM ruby:3.2.6-slim-bookworm
# install rails dependencies
RUN apt-get clean all && \
apt-get update -qq && \
apt-get install -qq -y \
build-essential \
libpq-dev \
curl \
gnupg2 \
apt-utils \
default-libmysqlclient-dev \
git \
libcurl3-dev \
cmake \
libssl-dev \
pkg-config \
openssl \
imagemagick \
file \
nodejs \
npm \
vim
# Set working directory
RUN mkdir /rails-app
WORKDIR /rails-app
# Consume build args
ARG RAILS_ENV
ARG RAILS_MASTER_KEY
# Add gems
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
# Install gems
COPY install_gems.sh install_gems.sh
RUN chmod u+x install_gems.sh && ./install_gems.sh
# Install Node.js dependencies
COPY package.json package-lock.json /rails-app/
RUN npm install
COPY . /rails-app
# Precompile assets (includes vite build via vite_rails gem)
COPY precompile_assets.sh precompile_assets.sh
RUN chmod u+x precompile_assets.sh && ./precompile_assets.sh
# Add entrypoint script
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]