From 7f5768a1e1f773b96e2509aa1b4b5f251a59b014 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Thu, 1 Aug 2024 21:21:31 +0200 Subject: [PATCH] dockerfile now also runs templ --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f19ce29..dfe85ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,18 @@ FROM alpine:3.19.3 as builder -RUN apk update && apk add go +RUN apk update && apk add go curl RUN mkdir -p /opt/converge/bin + +# if templ cannot be obtained: quick fix, remove this statement and run make, then build the image. +RUN curl -L https://github.com/a-h/templ/releases/download/v0.2.747/templ_Linux_x86_64.tar.gz -o templ.tar.gz && \ + tar xvzf templ.tar.gz templ && \ + chmod 755 templ && \ + mv templ /bin COPY cmd pkg static go.mod go.sum /opt/converge/ WORKDIR /opt/converge RUN go mod download COPY . /opt/converge/ +RUN templ generate RUN go build -ldflags "-linkmode 'external' -extldflags '-static'" -o bin ./cmd/... RUN GOOS=windows GOARCH=amd64 go build -o bin ./cmd/...