2024-07-29 23:38:43 +05:30
|
|
|
|
FROM --platform=$BUILDPLATFORM node:20-slim AS builder
|
2021-10-30 12:54:14 -04:00
|
|
|
|
|
|
|
|
|
# Build application and add additional files
|
|
|
|
|
WORKDIR /ghostfolio
|
|
|
|
|
|
2024-08-08 17:42:05 +02:00
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-suggests \
|
|
|
|
|
g++ \
|
|
|
|
|
git \
|
|
|
|
|
make \
|
|
|
|
|
openssl \
|
|
|
|
|
python3 \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2021-10-30 12:54:14 -04:00
|
|
|
|
# Only add basic files without the application itself to avoid rebuilding
|
|
|
|
|
# layers when files (package.json etc.) have not changed
|
|
|
|
|
COPY ./CHANGELOG.md CHANGELOG.md
|
|
|
|
|
COPY ./LICENSE LICENSE
|
|
|
|
|
COPY ./package.json package.json
|
2024-07-29 23:38:43 +05:30
|
|
|
|
COPY ./package-lock.json package-lock.json
|
2021-10-30 12:54:14 -04:00
|
|
|
|
COPY ./prisma/schema.prisma prisma/schema.prisma
|
|
|
|
|
|
2024-07-29 23:38:43 +05:30
|
|
|
|
RUN npm install
|
2021-10-30 12:54:14 -04:00
|
|
|
|
|
|
|
|
|
# See https://github.com/nrwl/nx/issues/6586 for further details
|
|
|
|
|
COPY ./decorate-angular-cli.js decorate-angular-cli.js
|
|
|
|
|
RUN node decorate-angular-cli.js
|
|
|
|
|
|
2025-01-02 10:50:41 +01:00
|
|
|
|
COPY ./apps apps
|
|
|
|
|
COPY ./libs libs
|
2022-05-08 16:55:14 +02:00
|
|
|
|
COPY ./jest.config.ts jest.config.ts
|
2025-01-02 10:50:41 +01:00
|
|
|
|
COPY ./jest.preset.js jest.preset.js
|
|
|
|
|
COPY ./nx.json nx.json
|
|
|
|
|
COPY ./replace.build.mjs replace.build.mjs
|
2021-10-30 12:54:14 -04:00
|
|
|
|
COPY ./tsconfig.base.json tsconfig.base.json
|
|
|
|
|
|
2024-07-29 23:38:43 +05:30
|
|
|
|
RUN npm run build:production
|
2021-10-30 12:54:14 -04:00
|
|
|
|
|
|
|
|
|
# Prepare the dist image with additional node_modules
|
|
|
|
|
WORKDIR /ghostfolio/dist/apps/api
|
|
|
|
|
# package.json was generated by the build process, however the original
|
2024-07-29 23:38:43 +05:30
|
|
|
|
# package-lock.json needs to be used to ensure the same versions
|
|
|
|
|
COPY ./package-lock.json /ghostfolio/dist/apps/api/package-lock.json
|
2021-10-30 12:54:14 -04:00
|
|
|
|
|
2024-07-29 23:38:43 +05:30
|
|
|
|
RUN npm install
|
2021-10-30 12:54:14 -04:00
|
|
|
|
COPY prisma /ghostfolio/dist/apps/api/prisma
|
|
|
|
|
|
|
|
|
|
# Overwrite the generated package.json with the original one to ensure having
|
|
|
|
|
# all the scripts
|
|
|
|
|
COPY package.json /ghostfolio/dist/apps/api
|
2024-07-29 23:38:43 +05:30
|
|
|
|
RUN npm run database:generate-typings
|
2021-10-30 12:54:14 -04:00
|
|
|
|
|
|
|
|
|
# Image to run, copy everything needed from builder
|
2024-07-20 10:30:05 +02:00
|
|
|
|
FROM node:20-slim
|
2024-06-10 17:42:17 +02:00
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/ghostfolio/ghostfolio"
|
2024-08-03 16:55:18 +02:00
|
|
|
|
ENV NODE_ENV=production
|
2024-06-10 17:42:17 +02:00
|
|
|
|
|
2024-08-03 16:55:18 +02:00
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-suggests \
|
2024-07-29 23:38:43 +05:30
|
|
|
|
curl \
|
|
|
|
|
openssl \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2022-08-27 14:37:22 +02:00
|
|
|
|
|
2024-08-08 17:42:05 +02:00
|
|
|
|
COPY --chown=node:node --from=builder /ghostfolio/dist/apps /ghostfolio/apps
|
|
|
|
|
COPY --chown=node:node ./docker/entrypoint.sh /ghostfolio/entrypoint.sh
|
2024-03-23 20:56:22 +01:00
|
|
|
|
WORKDIR /ghostfolio/apps/api
|
2023-02-11 09:37:44 +00:00
|
|
|
|
EXPOSE ${PORT:-3333}
|
2024-08-03 16:55:18 +02:00
|
|
|
|
USER node
|
2024-03-30 13:42:02 +01:00
|
|
|
|
CMD [ "/ghostfolio/entrypoint.sh" ]
|