diff --git a/infra/docker/Dockerfile.api b/infra/docker/Dockerfile.api index bbd6ad54..a937c278 100644 --- a/infra/docker/Dockerfile.api +++ b/infra/docker/Dockerfile.api @@ -17,17 +17,17 @@ RUN apk add --no-cache libc6-compat RUN apk update WORKDIR /app -# Install the dependencies +# First install dependencies (as they change less often) COPY .gitignore .gitignore COPY --from=builder /app/out/json/ . COPY --from=builder /app/out/yarn.lock ./yarn.lock RUN yarn install --network-timeout 100000 -# Build the project +# Build the project and its dependencies COPY --from=builder /app/out/full/ . COPY turbo.json turbo.json -# Remote caching +# Uncomment and use build args to enable remote caching # ARG TURBO_TEAM # ENV TURBO_TEAM=$TURBO_TEAM @@ -40,16 +40,9 @@ FROM base AS runner WORKDIR /app # Don't run production as root -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs -USER nextjs +RUN addgroup --system --gid 1001 expressjs +RUN adduser --system --uid 1001 expressjs +USER expressjs +COPY --from=installer /app . -#COPY --from=installer /app/apps/api/next.config.js . -COPY --from=installer /app/apps/api/package.json . - -# Reduce image size -#COPY --from=installer --chown=nextjs:nodejs /app/apps/api/.next/standalone ./ -#COPY --from=installer --chown=nextjs:nodejs /app/apps/api/.next/static ./apps/api/.next/static -#COPY --from=installer --chown=nextjs:nodejs /app/apps/api/public ./apps/api/public - -CMD node apps/api/server.js \ No newline at end of file +CMD node apps/api/dist/index.js \ No newline at end of file