mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 03:32:54 -05:00
64 lines
2.5 KiB
Docker
64 lines
2.5 KiB
Docker
FROM node:22-alpine AS deps
|
|
|
|
# Install required packages
|
|
RUN apk add --no-cache python3 openssl build-base
|
|
RUN corepack enable
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy only the files needed for installing dependencies
|
|
COPY .yarn ./.yarn
|
|
COPY yarn.lock package.json .yarnrc.yml ./
|
|
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
|
|
|
|
# Avoiding memory issues with ARMv7
|
|
RUN if [ "$(uname -m)" = "armv7l" ]; then yarn config set taskPoolConcurrency 2; yarn config set networkConcurrency 5; fi
|
|
|
|
# Focus the workspaces in production mode
|
|
RUN if [ "$(uname -m)" = "armv7l" ]; then npm_config_build_from_source=true yarn workspaces focus @actual-app/sync-server --production; else yarn workspaces focus @actual-app/sync-server --production; fi
|
|
|
|
FROM deps AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY packages/sync-server ./packages/sync-server
|
|
|
|
# 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
|
|
COPY packages/desktop-client/build ./node_modules/@actual-app/web/build
|
|
|
|
FROM alpine:3.22 AS prod
|
|
|
|
# Minimal runtime dependencies
|
|
RUN apk add --no-cache nodejs tini
|
|
|
|
# Create a non-root user
|
|
ARG USERNAME=actual
|
|
ARG USER_UID=1001
|
|
ARG USER_GID=$USER_UID
|
|
RUN addgroup -S ${USERNAME} -g ${USER_GID} && adduser -S ${USERNAME} -G ${USERNAME} -u ${USER_UID}
|
|
RUN 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 ./
|
|
|
|
ENTRYPOINT ["/sbin/tini","-g", "--"]
|
|
EXPOSE 5006
|
|
CMD ["node", "app.js"]
|