🐳 Update Dockerfile to optimize image build process and dependencies
This commit is contained in:
31
code/websites/pokedex.online/server/Dockerfile
Normal file
31
code/websites/pokedex.online/server/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# Backend Production Dockerfile
|
||||
FROM node:20-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install production dependencies only
|
||||
RUN npm ci --only=production
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
# Create directories for data and logs
|
||||
RUN mkdir -p /app/data /app/logs
|
||||
|
||||
# Set production environment
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Expose the server port
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check endpoint (will be added to server)
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:3000/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
||||
|
||||
# Run the application
|
||||
CMD ["node", "oauth-proxy.js"]
|
||||
Reference in New Issue
Block a user