Skip to content

Commit a11536e

Browse files
cirdesclaude
andcommitted
Update Dockerfile + dockerignore for monorepo build context
Build context for docs/Dockerfile is now the monorepo root, so the gem/ subtree is visible to bundle install and `path: "../gem"` in docs/Gemfile resolves correctly. Run from the repo root: docker build -f docs/Dockerfile . flyctl deploy --config docs/fly.toml --dockerfile docs/Dockerfile . Changes: - COPY gem /gem before `bundle install`, then COPY docs/Gemfile and docs/Gemfile.lock into /rails/. - COPY docs/package.json + docs/pnpm-lock.yaml separately, then COPY docs/ into /rails/ for the rest of the app code. - Final stage copies /gem too so the running container resolves the gem path at boot. - Move .dockerignore to repo root with paths rewritten to /docs/... and /gem/...; drop docs/.dockerignore. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6519877 commit a11536e

3 files changed

Lines changed: 75 additions & 57 deletions

File tree

.dockerignore

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Build context for docs/Dockerfile is the monorepo root.
2+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file
3+
4+
# Ignore git directory.
5+
/.git/
6+
/.gitignore
7+
8+
# Ignore bundler config in either subproject.
9+
/gem/.bundle
10+
/docs/.bundle
11+
12+
# Ignore environment files.
13+
/docs/.env*
14+
/gem/.env*
15+
16+
# Ignore default key files.
17+
/docs/config/master.key
18+
/docs/config/credentials/*.key
19+
20+
# Ignore logs and tempfiles.
21+
/docs/log/*
22+
/docs/tmp/*
23+
!/docs/log/.keep
24+
!/docs/tmp/.keep
25+
/docs/tmp/pids/*
26+
!/docs/tmp/pids/.keep
27+
28+
# Ignore storage (uploaded files in dev and SQLite databases).
29+
/docs/storage/*
30+
!/docs/storage/.keep
31+
/docs/tmp/storage/*
32+
!/docs/tmp/storage/.keep
33+
34+
# Ignore assets.
35+
/docs/node_modules/
36+
/docs/app/assets/builds/*
37+
!/docs/app/assets/builds/.keep
38+
/docs/public/assets
39+
40+
# Ignore gem build artifacts.
41+
/gem/pkg/
42+
/gem/node_modules/
43+
/gem/tmp/
44+
/gem/.ruby-lsp/
45+
46+
# Ignore CI service files.
47+
/.github
48+
49+
# Ignore Kamal files.
50+
/docs/config/deploy*.yml
51+
/docs/.kamal
52+
53+
# Ignore development files.
54+
/gem/.devcontainer
55+
/docs/.devcontainer
56+
57+
# Ignore Docker-related files.
58+
/.dockerignore
59+
/docs/.dockerignore
60+
/docs/Dockerfile*

docs/.dockerignore

Lines changed: 0 additions & 51 deletions
This file was deleted.

docs/Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# syntax=docker/dockerfile:1
22
# check=error=true
33

4-
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
4+
# Build context for this Dockerfile is the monorepo root, not docs/.
5+
# Run from the repo root:
6+
# docker build -f docs/Dockerfile .
7+
# flyctl deploy --config docs/fly.toml --dockerfile docs/Dockerfile .
8+
9+
# Make sure RUBY_VERSION matches the Ruby version in docs/.ruby-version
510
ARG RUBY_VERSION=3.4.7
611
FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-jemalloc-slim AS base
712

@@ -43,18 +48,21 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
4348
npm install -g pnpm@$PNPM_VERSION && \
4449
rm -rf /tmp/node-build-master
4550

46-
# Install application gems
47-
COPY Gemfile Gemfile.lock ./
51+
# Copy the gem first so docs/Gemfile's `path: "../gem"` resolves during bundle install.
52+
COPY gem /gem
53+
54+
# Install application gems (cwd = /rails)
55+
COPY docs/Gemfile docs/Gemfile.lock ./
4856
RUN bundle install && \
4957
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
5058
bundle exec bootsnap precompile --gemfile
5159

5260
# Install node modules
53-
COPY package.json ./
61+
COPY docs/package.json docs/pnpm-lock.yaml ./
5462
RUN pnpm install
5563

5664
# Copy application code
57-
COPY . .
65+
COPY docs/ ./
5866

5967
# Precompile bootsnap code for faster boot times
6068
RUN bundle exec bootsnap precompile app/ lib/
@@ -67,8 +75,9 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
6775
FROM base
6876

6977

70-
# Copy built artifacts: gems, application
78+
# Copy built artifacts: gems, application, and the gem subtree
7179
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
80+
COPY --from=build /gem /gem
7281
COPY --from=build /rails /rails
7382

7483
# Run and own only the runtime files as a non-root user for security

0 commit comments

Comments
 (0)