Add Dockerfile for single-container deployment
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
# ===== Imgur Clone - Single Container Deployment =====
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files first for better layer caching
|
||||
COPY package*.json ./
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# Copy application code
|
||||
COPY server.js ./
|
||||
COPY seed/ ./seed/
|
||||
COPY public/ ./public/
|
||||
|
||||
# Create uploads directory
|
||||
RUN mkdir -p /app/public/uploads
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
|
||||
|
||||
# Start the application
|
||||
CMD ["npm", "start"]
|
||||
Reference in New Issue
Block a user