-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (54 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
65 lines (54 loc) · 1.37 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
# Stage 1: Build Frontend
FROM node:22-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install
COPY frontend/ .
# Build for production
RUN npm run build
# Stage 2: Setup Backend & Serve
FROM ruby:3.3-alpine
# Install dependencies
RUN apk add --no-cache \
imagemagick \
imagemagick-dev \
sqlite-dev \
build-base \
tzdata \
git \
pkgconfig \
procps \
rust \
cargo \
musl-dev \
libwebp \
libwebp-dev \
libwebp-tools
WORKDIR /app
# Copy Gemfile and Gemfile.lock
COPY Gemfile Gemfile.lock ./
# Install gems
RUN bundle config set --local without 'development test' && \
bundle install
# Copy application code
COPY . .
# Copy built frontend assets from builder stage
# Store in /app/dist separate from user data
COPY --from=frontend-builder /app/frontend/dist ./dist
# Create necessary directories for volume mounts
RUN mkdir -p /data/uploads \
/data/public/processed \
/data/db \
/data/exports
# Expose port
EXPOSE 4567
# Environment variables
ENV RACK_ENV=production
ENV UPLOADS_PATH=/data/uploads
ENV PUBLIC_PATH=/data/public
ENV DB_PATH=/data/db/production.sqlite3
ENV EXPORTS_PATH=/data/exports
ENV STATIC_PATH=/app/dist
ENV RUBY_YJIT_ENABLE=1
# Start command
CMD ["sh", "-c", "bundle exec rake db:migrate && bundle exec puma -t 5:5 -p 4567 -e production"]