46 lines
1.4 KiB
Docker
46 lines
1.4 KiB
Docker
### ALPINE MULTI-STAGE
|
|
# Build stage for libraries
|
|
FROM node:22-alpine AS builder
|
|
|
|
# Node.js application build stage
|
|
WORKDIR /usr/src/app
|
|
COPY package*.json ./
|
|
RUN npm install -g typescript
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Final stage
|
|
FROM node:22-alpine
|
|
|
|
# Enable community repository for additional packages
|
|
RUN echo "https://dl-cdn.alpinelinux.org/alpine/v$(grep -oE '[0-9]+\.[0-9]+' /etc/alpine-release)/community" >> /etc/apk/repositories
|
|
RUN apk update
|
|
|
|
# Install runtime dependencies including AWS CLI v2
|
|
RUN apk add --no-cache bash redis ghostscript graphicsmagick imagemagick libjpeg-turbo libpng libwebp tiff libheif libde265 x265 ffmpeg curl tzdata aws-cli
|
|
|
|
# Verify AWS CLI installation
|
|
RUN aws --version
|
|
|
|
RUN npm install -g pm2
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy built application from builder
|
|
COPY --from=builder /usr/src/app/dist ./dist
|
|
# Copy TypeScript source files for source map support
|
|
COPY --from=builder /usr/src/app/*.ts ./
|
|
COPY --from=builder /usr/src/app/util ./util
|
|
COPY --from=builder /usr/src/app/jobs ./jobs
|
|
COPY --from=builder /usr/src/app/bills ./bills
|
|
COPY ./assets /assets
|
|
COPY --from=builder /usr/src/app/node_modules ./node_modules
|
|
COPY --from=builder /usr/src/app/.env.production ./.env.production
|
|
COPY --from=builder /usr/src/app/ecosystem.config.cjs ./ecosystem.config.cjs
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["sh", "-c", "redis-server --daemonize yes && npm run server"]
|