commit 42297313c2d5dbec6365249bfe9e62fe94875a71
parent af841efd53d9df0a881e30620a2031490352bf3e
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sun, 25 Aug 2024 13:01:26 +0200
feat(myheats-demo): add nginx container
Diffstat:
3 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/docker/docker-myheats-nginx/Dockerfile b/docker/docker-myheats-nginx/Dockerfile
@@ -0,0 +1,26 @@
+FROM docker.io/nginx:alpine
+
+RUN apk update
+RUN apk add --no-cache git npm
+
+WORKDIR /app
+RUN git clone --depth 1 https://git.in0rdr.ch/myheats.git /app
+
+# install npm dependencies to node_modules
+# https://docs.npmjs.com/cli/v10/commands/npm-ci
+RUN npm ci
+
+ENV NODE_ENV production
+ENV VITE_APP_DOC_TITLE 'My Heats'
+ENV VITE_APP_SUPABASE_URL ''
+ENV VITE_APP_SUPABASE_KEY 'changeme'
+
+# vite static build (for production)
+# https://vitejs.dev/guide/build
+RUN npm run build
+
+# install the static files
+RUN rm -rf /usr/share/nginx/html/*
+RUN cp -r dist/* /usr/share/nginx/html/
+
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/docker/docker-myheats-nginx/README.md b/docker/docker-myheats-nginx/README.md
@@ -0,0 +1,17 @@
+My Heats Nginx Image
+--------------------
+
+Build instructions for Digital Ocean.
+
+1 - Prepare build environment (variables are fixed during "vite build" step):
+ export VITE_APP_DOC_TITLE='My title'
+ export VITE_APP_SUPABASE_URL=
+ export VITE_APP_SUPABASE_KEY=
+
+2 - Build and push:
+ # https://cloud.digitalocean.com/account/api/tokens
+ podman login registry.digitalocean.com/myheats
+ buildah bud --network=slirp4netns -t registry.digitalocean.com/myheats/myheats:latest .
+ buildah push registry.digitalocean.com/myheats/myheats:latest
+
+3 - Use `digital-ocean-app.yaml` to configure the app in Digital Ocean.
diff --git a/docker/docker-myheats-nginx/digital-ocean-app.yaml b/docker/docker-myheats-nginx/digital-ocean-app.yaml
@@ -0,0 +1,25 @@
+alerts:
+- rule: DEPLOYMENT_FAILED
+- rule: DOMAIN_FAILED
+features:
+- buildpack-stack=ubuntu-22
+ingress:
+ rules:
+ - component:
+ name: myheats
+ match:
+ path:
+ prefix: /
+name: myheats-app
+region: fra
+services:
+- http_port: 80
+ image:
+ deploy_on_push:
+ enabled: true
+ registry_type: DOCR
+ repository: myheats
+ tag: latest
+ instance_count: 1
+ instance_size_slug: apps-s-1vcpu-0.5gb
+ name: myheats