diff --git a/Dockerfile b/Dockerfile index 8694896..2dbd7b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,15 @@ FROM node:20-alpine AS builder ARG SOURCE_COMMIT +ARG VITE_BOT_API_URL +ARG VITE_STATUS_API_KEY +ARG VITE_FRONTEND_URL + ENV SOURCE_COMMIT=${SOURCE_COMMIT} ENV NODE_ENV=production +ENV VITE_BOT_API_URL=${VITE_BOT_API_URL} +ENV VITE_STATUS_API_KEY=${VITE_STATUS_API_KEY} +ENV VITE_FRONTEND_URL=${VITE_FRONTEND_URL} WORKDIR /app @@ -18,6 +25,7 @@ COPY scripts ./scripts COPY locales ./locales COPY migrations ./migrations COPY tsconfig.json ./ +COPY .env* ./ RUN pnpm run build @@ -39,7 +47,6 @@ RUN pnpm run build FROM node:20-alpine AS production - RUN addgroup -g 1001 -S nodejs && \ adduser -S aethel -u 1001 @@ -48,6 +55,7 @@ WORKDIR /app RUN npm install -g pnpm COPY package.json pnpm-lock.yaml ./ +COPY .env* ./ RUN pnpm install --frozen-lockfile --prod && \ pnpm store prune @@ -56,7 +64,6 @@ COPY --from=builder --chown=aethel:nodejs /app/dist ./dist COPY --from=builder --chown=aethel:nodejs /app/locales ./locales COPY --from=builder --chown=aethel:nodejs /app/migrations ./migrations COPY --from=builder --chown=aethel:nodejs /app/scripts ./scripts - COPY --from=builder --chown=aethel:nodejs /app/web/dist ./web/dist RUN mkdir -p /app/logs && chown aethel:nodejs /app/logs @@ -66,6 +73,6 @@ USER aethel EXPOSE 2020 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD node -e "process.exit(0)" || exit 1 + CMD wget --no-verbose --tries=1 --spider http://localhost:2020/api/status || exit 1 CMD ["pnpm", "run", "start"]