hexabot/api/Dockerfile

62 lines
903 B
Docker
Raw Normal View History

2024-09-10 09:50:11 +00:00
FROM node:18-alpine AS builder
WORKDIR /app
2024-09-29 10:49:05 +00:00
COPY package*.json ./
2024-09-10 09:50:11 +00:00
2024-09-29 10:49:05 +00:00
COPY merge-extensions-deps.js ./
2024-09-27 10:22:18 +00:00
2024-09-29 10:49:05 +00:00
COPY src/extensions ./src/extensions
2024-09-27 10:22:18 +00:00
2024-09-29 10:49:05 +00:00
COPY patches ./patches
2024-09-27 10:22:18 +00:00
2024-09-29 10:49:05 +00:00
RUN npm ci
2024-09-27 10:22:18 +00:00
2024-09-29 10:49:05 +00:00
COPY . .
2024-09-27 10:22:18 +00:00
2024-09-29 10:49:05 +00:00
RUN npm run build
2024-09-27 10:22:18 +00:00
2024-09-27 22:57:15 +00:00
FROM node:18-alpine AS development
2024-09-10 09:50:11 +00:00
WORKDIR /app
2024-09-29 10:49:05 +00:00
COPY package*.json ./
2024-09-10 09:50:11 +00:00
2024-09-29 10:49:05 +00:00
COPY --from=builder /app/merge-extensions-deps.js ./
COPY --from=builder /app/src/extensions ./src/extensions
COPY --from=builder /app/patches ./patches
2024-09-10 09:50:11 +00:00
2024-09-27 22:57:15 +00:00
RUN npm install
2024-09-10 09:50:11 +00:00
2024-09-29 10:49:05 +00:00
COPY . .
ENV NODE_ENV=development
2024-09-27 10:22:18 +00:00
EXPOSE 3000
2024-09-10 09:50:11 +00:00
2024-09-27 22:57:15 +00:00
CMD ["npm", "run", "start:debug"]
2024-09-10 09:50:11 +00:00
2024-09-27 22:57:15 +00:00
FROM node:18-alpine AS production
2024-09-10 09:50:11 +00:00
WORKDIR /app
2024-09-29 10:49:05 +00:00
COPY package*.json ./
2024-09-27 10:22:18 +00:00
2024-09-29 10:49:05 +00:00
COPY --from=builder /app/merge-extensions-deps.js ./
COPY --from=builder /app/src/extensions ./src/extensions
COPY --from=builder /app/patches ./patches
2024-09-10 09:50:11 +00:00
2024-09-29 10:49:05 +00:00
RUN npm ci --only=production
COPY --from=builder /app/dist ./dist
ENV NODE_ENV=production
2024-09-10 09:50:11 +00:00
EXPOSE 3000
2024-09-27 22:57:15 +00:00
CMD ["npm", "run", "start:prod"]