Skip to content

Commit 30eaa53

Browse files
committed
feat: Deployment config (docker/k8s)
1 parent 60fa6a5 commit 30eaa53

File tree

10 files changed

+2122
-1
lines changed

10 files changed

+2122
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
/build

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM nginx:1.21.1
2+
COPY build/ /usr/share/nginx/html
3+
# COPY nginx.conf /etc/nginx/nginx.conf

artifacts/deployment.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
kind: Deployment
2+
apiVersion: apps/v1
3+
metadata:
4+
name: poly-volca-web
5+
namespace: openfaas-fn
6+
labels:
7+
app: poly-volca-web
8+
spec:
9+
replicas: 2
10+
selector:
11+
matchLabels:
12+
app: poly-volca-web
13+
template:
14+
metadata:
15+
labels:
16+
app: poly-volca-web
17+
spec:
18+
containers:
19+
- name: poly-volca-web
20+
image: rafaelpernil/poly-volca-web
21+
imagePullPolicy: Always
22+
ports:
23+
- containerPort: 80
24+
restartPolicy: Always

artifacts/service.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: poly-volca-web
5+
namespace: openfaas-fn
6+
spec:
7+
ports:
8+
- port: 80
9+
targetPort: 80
10+
protocol: TCP
11+
selector:
12+
app: poly-volca-web

buildDeploy.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
npm i -g pnpm
3+
pnpm i
4+
pnpm run build
5+
docker build -t poly-volca-web .
6+
docker tag poly-volca-web rafaelpernil/poly-volca-web
7+
docker push rafaelpernil/poly-volca-web
8+
9+
kubectl apply -f ./artifacts/deployment.yaml
10+
kubectl apply -f ./artifacts/service.yaml
11+
12+
kubectl scale --replicas=0 deployment poly-volca-web -n openfaas-fn
13+
kubectl scale --replicas=2 deployment poly-volca-web -n openfaas-fn

buildMultiArch.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
npm i -g pnpm
3+
pnpm i
4+
pnpm run build
5+
6+
docker tag poly-volca-web rafaelpernil/poly-volca-web
7+
docker buildx build --push --platform linux/arm/v7,linux/arm64,linux/amd64 --tag rafaelpernil/poly-volca-web .
8+
#docker push rafaelpernil/poly-volca-web

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ <h3>Algorithm:&nbsp</h3>
3737
<select required="true" title="AlgorithmSelector" name="AlgorithmSelector" id="AlgorithmSelector"></select>
3838
</div>
3939
</body>
40-
<script src="index.js"></script>
40+
<script src="index.min.js"></script>
4141

4242
</html>

nginx.conf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# nginx.conf
2+
user nginx;
3+
worker_processes auto;
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
events {
7+
worker_connections 1024;
8+
}
9+
http {
10+
include /etc/nginx/mime.types;
11+
default_type application/octet-stream;
12+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
13+
'$status $body_bytes_sent "$http_referer" '
14+
'"$http_user_agent" "$http_x_forwarded_for"';
15+
access_log /var/log/nginx/access.log main;
16+
sendfile on;
17+
#tcp_nopush on;
18+
19+
keepalive_timeout 65;
20+
#gzip on;
21+
#include /etc/nginx/conf.d/*.conf;
22+
server {
23+
listen 80;
24+
location / {
25+
root /usr/share/nginx/html;
26+
index index.html index.htm;
27+
try_files $uri $uri/ /index.html;
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)