Skip to content

Dockerfile, kubernetes manifest and README update #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use an official Node runtime as a parent image
FROM node:14-alpine

# Set the working directory in the container to /app
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install the application dependencies
RUN npm install

# Copy the rest of the application to the working directory
COPY . .

# Build the application
RUN npm run build

# Use an official Nginx runtime as a parent image for the runtime stage
FROM nginx:stable-alpine

# Copy the build output to replace the default Nginx contents.
COPY --from=0 /app/build /usr/share/nginx/html

# Expose port 80 on the container
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,13 @@ This section has moved here: [https://facebook.github.io/create-react-app/docs/d
### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

### Dockerfile

One can build the containerized version using `docker build -t pomodoro .`

One can then run it using `docker run -d -p 8080:80 pomodoro`

There is also a Kubernetes manifest yaml. Update the ingress as you see fit, but it will need a valid ClusterIssuer and DNS name if using Nginx.


59 changes: 59 additions & 0 deletions kubernetes/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: v1
kind: Service
metadata:
name: pomosimple
spec:
selector:
app: pomosimple
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pomosimple
spec:
replicas: 1
selector:
matchLabels:
app: pomosimple
template:
metadata:
labels:
app: pomosimple
spec:
containers:
- name: pomosimple
image: idjohnson/pomonginx:latest
ports:
- containerPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: pomosimple
annotations:
cert-manager.io/cluster-issuer: YOURCLUSTERISSUER
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.org/websocket-services: pomosimple
spec:
rules:
- host: pomodoro.example.com
http:
paths:
- pathType: ImplementationSpecific
path: "/"
backend:
service:
name: pomosimple
port:
number: 80
tls:
- hosts:
- pomodoro.example.com
secretName: pomosimple-tls