Everything is now containerised and in the docker compose

This commit is contained in:
2025-08-09 17:40:01 +01:00
parent 371f48b42f
commit 22328ae6b1
11 changed files with 375 additions and 51 deletions

32
backend/Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
# Use Node.js 18 LTS as base image
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
# Copy application code
COPY . .
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nodejs -u 1001
# Change ownership of the app directory
RUN chown -R nodejs:nodejs /app
USER nodejs
# Expose port
EXPOSE 5000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:5000/', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"
# Start the application
CMD ["npm", "start"]