-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (58 loc) · 1.71 KB
/
Dockerfile
File metadata and controls
71 lines (58 loc) · 1.71 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM ruby:2.7.8-slim-bullseye
# Install OS / Rails dependencies
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
curl \
gnupg2 \
git \
cmake \
libssl-dev \
pkg-config \
openssl \
imagemagick \
file \
graphviz \
default-libmysqlclient-dev \
libcurl4-openssl-dev \
shared-mime-info \
libvips \
libvips-tools \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js (for Vite build)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get update -qq && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
# Set working directory
RUN mkdir /rails-app
WORKDIR /rails-app
# Build args (injected from CodeBuild)
ARG RAILS_ENV
ARG RAILS_MASTER_KEY
ARG ROLLBAR_ENV
# Set ENV so Rails sees them during asset precompile
ENV RAILS_ENV=${RAILS_ENV}
ENV RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
ENV ROLLBAR_ENV=${ROLLBAR_ENV}
# Install gems
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
COPY install_gems.sh install_gems.sh
RUN chmod u+x install_gems.sh && ./install_gems.sh
# Frontend install (cacheable)
COPY frontend/package.json frontend/package.json
COPY frontend/package-lock.json frontend/package-lock.json
RUN cd frontend && npm ci
# Copy app code
COPY . /rails-app
# Build SPA (outputs to public/spa per your vite.config.ts)
RUN cd frontend && npm run build
# Precompile Rails assets (sprockets/admin)
COPY precompile_assets.sh precompile_assets.sh
RUN chmod u+x precompile_assets.sh && ./precompile_assets.sh
# Entrypoint
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]