Optimize dockerfile for EmbedFiles option

This commit is contained in:
Laptop
2024-12-29 13:33:40 +02:00
parent 5afc1e830a
commit 26dd353985

View File

@@ -6,6 +6,10 @@ ARG TARGETARCH
WORKDIR /build
COPY . .
# fuck google
RUN go env -w GOPROXY=direct
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN templ generate
@@ -21,12 +25,14 @@ RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -ldflags "-s -w
RUN echo "soundcloak:x:5000:5000:Soundcloak user:/:/sbin/nologin" > /etc/minimal-passwd && \
echo "soundcloak:x:5000:" > /etc/minimal-group
RUN soundcloakctl postbuild
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /build/assets /assets
COPY --from=build /build/instance /instance
COPY --from=build /build/external /external
COPY --from=build /build/static/assets /static/assets
COPY --from=build /build/static/instance /static/instance
COPY --from=build /build/static/external /static/external
COPY --from=build /build/app /app
COPY --from=build /etc/minimal-passwd /etc/passwd
COPY --from=build /etc/minimal-group /etc/group