ci(docker): add production dockerfile, compose config, and gitea actions pipeline
Build and Push Fridger Container / Build & Push Fridger Image (push) Failing after 31s
Build and Push Fridger Container / Build & Push Fridger Image (push) Failing after 31s
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
# Multi-stage lightweight Docker image for Fridger
|
||||
FROM node:22-alpine AS runner
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /app
|
||||
|
||||
# Set environment
|
||||
ENV NODE_ENV=production \
|
||||
PORT=3000 \
|
||||
FRIDGER_DATA_DIR=/data \
|
||||
FRIDGER_DB_PATH=/data/fridger.db
|
||||
|
||||
# Install dependencies first for layer caching
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev && npm cache clean --force
|
||||
|
||||
# Copy application source
|
||||
COPY server.js db.js barcode.js ./
|
||||
COPY public/ ./public/
|
||||
|
||||
# Setup persistent data storage directory with proper permissions
|
||||
RUN mkdir -p /data && chown -R node:node /app /data
|
||||
|
||||
# Use non-root user
|
||||
USER node
|
||||
|
||||
# Expose web port
|
||||
EXPOSE 3000
|
||||
|
||||
# Declare persistent volume
|
||||
VOLUME ["/data"]
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user