From 69df06dec780a4dd5019816f0b2adf769c992e4a Mon Sep 17 00:00:00 2001 From: oneils Date: Thu, 5 Oct 2023 13:50:47 +0200 Subject: [PATCH] Issue #31: Replace separate UI with the embedded HTMX based - updated Docker files to build the app correctly --- Dockerfile | 14 ++------------ backend/ui/efs.go | 3 +++ docker-compose-dev.yml | 1 + docker-compose.yml | 1 + 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index b402c66..a59158b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ ARG SKIP_TEST ENV GOFLAGS="-mod=vendor" ADD backend /build/secrets +ADD backend/ui/static /build/secrets/ui/static ADD .git /build/secrets/.git WORKDIR /build/secrets @@ -27,21 +28,10 @@ RUN \ go build -o secrets -ldflags "-X main.revision=${version} -s -w" ./app -FROM node:10.19.0-alpine3.11 as build-frontend -WORKDIR /srv/frontend/ - -RUN apk add --no-cache --update git python make g++ -COPY ./frontend/package.json ./frontend/package-lock.json ./ -RUN npm install - -COPY ./frontend /srv/frontend -RUN npm run build -RUN npm prune --production - FROM umputun/baseimage:app-latest COPY --from=build-backend /build/secrets/secrets /srv/secrets -COPY --from=build-frontend /srv/frontend/public/ /srv/docroot +COPY --from=build-backend /build/secrets/ui/static /srv/ui/static/ WORKDIR /srv EXPOSE 8080 diff --git a/backend/ui/efs.go b/backend/ui/efs.go index 408d93b..509b929 100644 --- a/backend/ui/efs.go +++ b/backend/ui/efs.go @@ -1,6 +1,9 @@ +// Package ui provides embedded static files package ui import "embed" +// Files is embedded static files +// //go:embed "html" "static" var Files embed.FS diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 7907ce6..4e58bc8 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -21,5 +21,6 @@ services: - BOLT_FILE=/data/secrets.bd - PIN_ATTEMPTS=3 - MAX_EXPIRE=24h + - DOMAIN=localhost:8080 ports: - "8080:8080" diff --git a/docker-compose.yml b/docker-compose.yml index 9f96de9..91fa3e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,6 +24,7 @@ services: - BOLT_FILE=/data/secrets.bd - PIN_ATTEMPTS=3 - MAX_EXPIRE=24h + - DOMAIN=www.example.com # important! change to your domain # uncomment to expose directly without nginx proxy # ports: # - "80:8080"