mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 06:30:42 +00:00
adding docker deployment
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
# Use an official Node runtime as the base image
|
||||
FROM node:18
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN npm run build-prod
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 3000
|
||||
|
||||
# Define the command to run the app
|
||||
CMD [ "node", "dist/server/server.js" ]
|
||||
@@ -0,0 +1,18 @@
|
||||
version: '3'
|
||||
services:
|
||||
game-server:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
- /etc/letsencrypt:/etc/letsencrypt
|
||||
depends_on:
|
||||
- game-server
|
||||
@@ -7,7 +7,6 @@
|
||||
"start:client": "webpack serve --open --node-env development",
|
||||
"start:server": "node --loader ts-node/esm --experimental-specifier-resolution=node src/server/Server.ts",
|
||||
"dev": "concurrently \"npm run start:client\" \"npm run start:server\"",
|
||||
"build": "tsc",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Ensure you're authenticated with Google Cloud
|
||||
gcloud auth configure-docker
|
||||
|
||||
# Build the new Docker image
|
||||
docker build -t openfrontio .
|
||||
|
||||
# Tag the new image (use a version number or 'latest')
|
||||
docker tag openfrontio gcr.io/[YOUR-PROJECT-ID]/openfrontio:latest
|
||||
|
||||
# Push the new image to Google Container Registry
|
||||
docker push gcr.io/[YOUR-PROJECT-ID]/openfrontio:latest
|
||||
|
||||
# Update the GCE instance with the new container image
|
||||
gcloud compute instances update-container openfrontio-instance \
|
||||
--container-image us-central1-docker.pkg.dev/openfrontio/openfrontio:latest \
|
||||
--zone=us-central1-a
|
||||
|
||||
echo "Deployment complete. New version should be live soon."
|
||||
Reference in New Issue
Block a user