much more simple way to build static images.

This commit is contained in:
Erik Brakkee 2024-09-06 19:45:57 +02:00
parent db8a6be7ba
commit 08f331634e

View File

@ -8,6 +8,7 @@ RUN curl -L https://github.com/a-h/templ/releases/download/v0.2.747/templ_Linux_
tar xvzf templ.tar.gz templ && \
chmod 755 templ && \
mv templ /bin
ENV CGO_ENABLED=0
COPY go.mod go.sum /opt/converge/
COPY static /opt/converge/static
COPY pkg /opt/converge/pkg
@ -18,7 +19,7 @@ WORKDIR /opt/converge
ENV GOTOOLCHAIN=auto
RUN go mod download
RUN templ generate
RUN go build -ldflags "-linkmode 'external' -extldflags '-static'" -o bin ./cmd/...
RUN go build -o bin ./cmd/...
RUN GOOS=windows GOARCH=amd64 go build -o bin ./cmd/...
FROM scratch