Add production Dockerfile with multi-stage build
Assisted-by: GLM-5.1 via pi
change mxvkkqurytwntmvukouzosxlrsxolqrm
commit da5aef605217a6b66bc983fb163a71a88c21233d
author Alpha Chen <alpha@kejadlen.dev>
date
parent uyrruyvv
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..1d5835c
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+.git
+.jj
+.envrc
+db/*.db
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..c24df6c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,29 @@
+FROM ruby:3.3-slim AS base
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+    libsqlite3-0 \
+    && rm -rf /var/lib/apt/lists/*
+
+WORKDIR /app
+
+FROM base AS build
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+    build-essential \
+    libsqlite3-dev \
+    && rm -rf /var/lib/apt/lists/*
+
+COPY Gemfile Gemfile.lock ./
+RUN bundle config set --local without "development test" \
+    && bundle install
+
+COPY . .
+
+FROM base
+
+COPY --from=build /usr/local/bundle /usr/local/bundle
+COPY --from=build /app .
+
+EXPOSE 9292
+
+CMD ["bundle", "exec", "puma", "-p", "9292"]