fixed issue where too much data was copied at every build, leading to

unnecessary build.
This commit is contained in:
Erik Brakkee 2024-08-29 13:16:08 +02:00
parent 8683949132
commit f5d8a5a424

View File

@ -8,11 +8,15 @@ 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
COPY cmd pkg static go.mod go.sum /opt/converge/
COPY go.mod go.sum /opt/converge/
COPY static /opt/converge/static
COPY pkg /opt/converge/pkg
COPY cmd /opt/converge/cmd
RUN find /opt/converge -type d
WORKDIR /opt/converge
ENV GOTOOLCHAIN=auto
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/...