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