mirror of
https://github.com/actualbudget/actual.git
synced 2026-07-11 11:13:11 -05:00
* [AI] sync-server.Dockerfile: unbreak `yarn build:server` after lage migration After #7602 moved the browser build to lage, the root sync-server.Dockerfile broke in two ways: 1. lage.config.js was never copied into the deps stage, so `lage` had no pipeline config inside the image. 2. lage's task hasher invokes `git ls-tree HEAD` during initialization (even for targets with `cache: false`), but .dockerignore strips `.git`, so the build aborts before vite ever runs. Copy lage.config.js alongside the other root config files, and seed a throwaway single-commit git repo in the builder stage right before `yarn build:server` so lage's hasher has a HEAD to read. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add release notes for PR #7861 --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
77 lines
2.9 KiB
Docker
77 lines
2.9 KiB
Docker
FROM node:22-bookworm AS deps
|
|
|
|
# Install required packages
|
|
RUN apt-get update && apt-get install -y openssl
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy only the files needed for installing dependencies
|
|
COPY .yarn ./.yarn
|
|
COPY yarn.lock package.json .yarnrc.yml tsconfig.json lage.config.js ./
|
|
COPY packages/api/package.json packages/api/package.json
|
|
COPY packages/component-library/package.json packages/component-library/package.json
|
|
COPY packages/crdt/package.json packages/crdt/package.json
|
|
COPY packages/desktop-client/package.json packages/desktop-client/package.json
|
|
COPY packages/desktop-electron/package.json packages/desktop-electron/package.json
|
|
COPY packages/eslint-plugin-actual/package.json packages/eslint-plugin-actual/package.json
|
|
COPY packages/loot-core/package.json packages/loot-core/package.json
|
|
COPY packages/sync-server/package.json packages/sync-server/package.json
|
|
COPY packages/plugins-service/package.json packages/plugins-service/package.json
|
|
|
|
COPY ./bin/package-browser ./bin/package-browser
|
|
|
|
RUN yarn install
|
|
|
|
FROM deps AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY packages/ ./packages/
|
|
|
|
# Increase memory limit for the build process to 8GB
|
|
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
|
|
# lage's task hasher invokes `git ls-tree HEAD` during initialization, so it
|
|
# needs a git repo even when individual targets disable caching. .dockerignore
|
|
# omits the real .git, so seed a throwaway repo with a single commit here.
|
|
RUN git -c init.defaultBranch=master init -q \
|
|
&& git -c user.email=build@docker -c user.name=docker-build add -A \
|
|
&& git -c user.email=build@docker -c user.name=docker-build commit -qm build
|
|
|
|
RUN yarn build:server
|
|
|
|
# Focus the workspaces in production mode (including @actual-app/web you just built)
|
|
RUN yarn workspaces focus @actual-app/sync-server --production
|
|
|
|
# Remove symbolic links for @actual-app/web and @actual-app/sync-server
|
|
RUN rm -rf ./node_modules/@actual-app/web ./node_modules/@actual-app/sync-server
|
|
|
|
# Copy in the @actual-app/web artifacts manually, so we don't need the entire packages folder
|
|
COPY ./packages/desktop-client/package.json ./node_modules/@actual-app/web/package.json
|
|
RUN cp -r ./packages/desktop-client/build ./node_modules/@actual-app/web/build
|
|
|
|
FROM node:22-bookworm-slim AS prod
|
|
|
|
# Minimal runtime dependencies
|
|
RUN apt-get update && apt-get install -y tini && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create a non-root user
|
|
ARG USERNAME=actual
|
|
ARG USER_UID=1001
|
|
ARG USER_GID=$USER_UID
|
|
RUN groupadd --gid $USER_GID $USERNAME \
|
|
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
|
|
&& mkdir /data && chown -R ${USERNAME}:${USERNAME} /data
|
|
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
|
|
# Pull in only the necessary artifacts (built node_modules, server files, etc.)
|
|
COPY --from=builder /app/node_modules /app/node_modules
|
|
COPY --from=builder /app/packages/sync-server/package.json ./
|
|
COPY --from=builder /app/packages/sync-server/build ./build
|
|
|
|
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
|
|
EXPOSE 5006
|
|
CMD ["node", "build/app.js"]
|