commit e8bc1828fbc0fe5990438ee3775f4b86d8aaa82d
parent 42297313c2d5dbec6365249bfe9e62fe94875a71
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sun, 25 Aug 2024 15:03:16 +0200
feat(myheats-nginx): add VITE_APP_EMAIL_REDIRECT_TO
Diffstat:
2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/docker/docker-myheats-nginx/Dockerfile b/docker/docker-myheats-nginx/Dockerfile
@@ -1,5 +1,14 @@
FROM docker.io/nginx:alpine
+ARG VITE_APP_DOC_TITLE='My Heats'
+ARG VITE_APP_SUPABASE_URL=''
+ARG VITE_APP_SUPABASE_KEY='changeme'
+# use the digital ocean app URI (or any other CNAME)
+ARG VITE_APP_EMAIL_REDIRECT_TO=''
+# use NODE_ENV=prod to exclude the `devDependencies` (e..g, vite)
+# we require `vite` command in `npm run build` below
+ARG NODE_ENV=dev
+
RUN apk update
RUN apk add --no-cache git npm
@@ -10,11 +19,6 @@ RUN git clone --depth 1 https://git.in0rdr.ch/myheats.git /app
# 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
diff --git a/docker/docker-myheats-nginx/README.md b/docker/docker-myheats-nginx/README.md
@@ -4,14 +4,31 @@ 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=
+ # use the digital ocean app URI (or any other CNAME)
+ export VITE_APP_EMAIL_REDIRECT_TO=https://lobster-app-7xrrb.ondigitalocean.app
+
+ # use NODE_ENV=prod to exclude the `devDependencies` (e..g, vite)
+ export NODE_ENV=dev
+
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 bud --no-cache \
+ --build-arg="VITE_APP_DOC_TITLE=$VITE_APP_DOC_TITLE" \
+ --build-arg="VITE_APP_SUPABASE_URL=$VITE_APP_SUPABASE_URL" \
+ --build-arg="VITE_APP_SUPABASE_KEY=$VITE_APP_SUPABASE_KEY" \
+ --build-arg="VITE_APP_EMAIL_REDIRECT_TO=$VITE_APP_EMAIL_REDIRECT_TO" \
+ --build-arg="NODE_ENV=$NODE_ENV" \
+ --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.