44 lines
824 B
Docker
44 lines
824 B
Docker
###########
|
||
# Stage 1 #
|
||
###########
|
||
# Build stage with all dependencies
|
||
FROM node:24.12-alpine as build
|
||
|
||
WORKDIR /app
|
||
|
||
# Copy package files
|
||
COPY . .
|
||
|
||
# Install production dependencies only
|
||
RUN npm ci
|
||
|
||
RUN npm run build
|
||
|
||
###########
|
||
# Stage 2 #
|
||
###########
|
||
# Small final image with only what’s needed to run
|
||
FROM node:24.12-alpine AS production
|
||
|
||
WORKDIR /app
|
||
|
||
# Copy package files first to install runtime deps
|
||
COPY package*.json ./
|
||
|
||
# curl install
|
||
RUN apk add --no-cache curl
|
||
|
||
# Only install production dependencies
|
||
RUN npm ci --omit=dev
|
||
|
||
|
||
COPY --from=build /app/dist ./dist
|
||
|
||
ENV RUNNING_IN_DOCKER=true
|
||
EXPOSE 3000
|
||
# start the app up
|
||
CMD ["npm", "run", "start:docker"]
|
||
|
||
# Add health check
|
||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||
CMD curl -f http://localhost:3000/lst/api/stats || exit 1 |