diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 88ce4c87..7f34076c 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -14,12 +14,14 @@ ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable COPY --chown=root:root --chmod=755 package.json turbo.json pnpm-*.yaml ./ -COPY --chown=root:root --chmod=755 apps/api/package.json apps/api/tsconfig.json apps/api/ -COPY --chown=root:root --chmod=755 packages packages RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ - pnpm install --ignore-scripts --frozen-lockfile && \ - rm -rf /root/.npm /root/.node-gyp /tmp/npm-* +pnpm install --ignore-scripts --frozen-lockfile && \ +rm -rf /root/.npm /root/.node-gyp /tmp/npm-* + +COPY --chown=root:root --chmod=755 packages packages +COPY --chown=root:root --chmod=755 apps/api/package.json apps/api/tsconfig.json apps/api/ + COPY --chown=root:root --chmod=755 apps/api/src apps/api/src @@ -27,20 +29,20 @@ RUN pnpm db:generate-types && \ pnpm build:api && \ pnpm sourcemaps:api -USER node +# USER node FROM node:20-alpine AS prod # Don't run production as root USER node -ENV NODE_ENV=dev +ENV NODE_ENV=production WORKDIR /app -COPY --chown=root:root --chmod=755 --from=build /app/node_modules /app/node_modules -COPY --chown=root:root --chmod=755 --from=build /app/apps/api/node_modules /app/apps/api/node_modules -COPY --chown=root:root --chmod=755 --from=build /app/apps/api/dist /app/apps/api/dist +# COPY --chown=root:root --chmod=755 --from=build /app/node_modules /app/node_modules +COPY --chown=node:node --chmod=755 --from=build /app/apps/api/node_modules /app/apps/api/node_modules +COPY --chown=node:node --chmod=755 --from=build /app/apps/api/dist /app/apps/api/dist EXPOSE ${API_PORT}