diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a9cbf45 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Build Stage +FROM node:20 AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN npm install + +COPY . . +RUN npm run build + +# Production Stage +FROM nginx:alpine + +COPY --from=builder /app/dist /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..72f9b67 --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,20 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: snake-app +spec: + replicas: 2 + selector: + matchLabels: + app: snake + template: + metadata: + labels: + app: snake + spec: + containers: + - name: snake + image: arvindgirish/snake:latest + imagePullPolicy: Always + ports: + - containerPort: 8080 diff --git a/package.json b/package.json index 6ff8462..a5bee5d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "JavaScript Snake
By Patrick Gillespie
License: MIT
http://patorjk.com/games/snake", "scripts": { - "start": "parcel src/index.html --open", + "start": "parcel src/index.html", "build": "parcel build src/index.html", "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/service.yaml b/service.yaml new file mode 100644 index 0000000..78d154a --- /dev/null +++ b/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: snake-service +spec: + type: LoadBalancer + selector: + app: online + ports: + - port: 80 + targetPort: 80