From 89c291f27ad5992f0388989f84166d76b12c3799 Mon Sep 17 00:00:00 2001 From: smingolelli Date: Fri, 20 Feb 2026 22:00:31 -0500 Subject: [PATCH] feat: Add Docker support with multi-stage build - Add Dockerfile with Node.js build and Nginx production stages - Add docker-compose.yml for local development with build - Add docker-compose.simple.yml for running from GHCR - Add .dockerignore to optimize build context - Use Debian-based Node image for ARM compatibility --- .dockerignore | 8 ++++++++ Dockerfile | 29 +++++++++++++++++++++++++++++ docker-compose.simple.yml | 9 +++++++++ docker-compose.yml | 28 ++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.simple.yml create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e291088 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +node_modules +npm-debug.log +.git +.gitignore +.parcel-cache +dist +*.md +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..38dadf7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Build stage +FROM node:18-slim as builder + +WORKDIR /app + +# Copy package files +COPY package*.json ./ + +# Install dependencies +RUN npm ci + +# Copy source code +COPY . . + +# Build the application +RUN npm run build + +# Production stage +FROM nginx:alpine + +# Copy built files from builder stage +COPY --from=builder /app/dist /usr/share/nginx/html + +# Copy nginx configuration (optional - uses default if not provided) +# COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.simple.yml b/docker-compose.simple.yml new file mode 100644 index 0000000..9290622 --- /dev/null +++ b/docker-compose.simple.yml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + connections-game: + image: ghcr.io/slmingol/react-connections-game:latest + container_name: react-connections-game + ports: + - "3000:80" + restart: unless-stopped diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9a8a674 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: '3.8' + +services: + connections-game: + build: + context: . + dockerfile: Dockerfile + container_name: react-connections-game + ports: + - "3000:80" + restart: unless-stopped + environment: + - NODE_ENV=production + + # Development service (optional - uncomment to use) + # connections-game-dev: + # image: node:18-alpine + # container_name: react-connections-game-dev + # working_dir: /app + # volumes: + # - .:/app + # - /app/node_modules + # ports: + # - "1234:1234" + # command: sh -c "npm install && npm run dev" + # environment: + # - NODE_ENV=development + # restart: unless-stopped