feat(docker): added in docker build stuff to run this in docker as well as windows service

This commit is contained in:
2026-01-13 17:05:23 -06:00
parent e6d996e40b
commit 780335d35c
5 changed files with 69 additions and 85 deletions

View File

@@ -1,23 +1,44 @@
FROM node:24.12-alpine
###########
# Stage 1 #
###########
# Build stage with all dependencies
FROM node:24.12-alpine as build
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY . .
# Install production dependencies only
RUN npm ci
RUN npm build:app
RUN npm run build
# Copy built app from builder stage
COPY --from=builder /app/dist ./dist
###########
# Stage 2 #
###########
# Small final image with only whats needed to run
FROM node:24.12-alpine AS production
# Environment variables with defaults
ENV PORT=3000
ENV DB_USER=admin
ENV DB_PASSWORD=changeme
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"]
CMD ["node", "dist/index.js"]
# Add health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:3000/lst/api/stats || exit 1