add ldflag (please work)

This commit is contained in:
Midou36O
2023-04-28 18:15:28 +01:00
parent 0b8cc79ef4
commit 1904363899
3 changed files with 25 additions and 3 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ pipeline:
branch: dev
image: woodpeckerci/plugin-docker-buildx
settings:
dockerfile: Dockerfile
dockerfile: DockerfileDev
registry: https://codeberg.org/v2
repo: codeberg.org/gothub/gothub
platforms: linux/amd64,linux/arm64
+2 -2
View File
@@ -7,7 +7,7 @@ RUN apk --no-cache add git
RUN git clone https://codeberg.org/gothub/gothub .
RUN go mod download
RUN GOOS=linux GOARCH=$TARGETARCH go build -o /src/gothub
RUN GOOS=linux GOARCH=$TARGETARCH go build -o /src/gothub
FROM alpine:3.16 as bin
@@ -19,4 +19,4 @@ COPY --from=build /src/public ./public
ENV DOCKER true
EXPOSE 3000
CMD ["/app/gothub", "serve"]
CMD ["/app/gothub", "serve"]
+22
View File
@@ -0,0 +1,22 @@
FROM --platform=$BUILDPLATFORM golang:alpine AS build
ARG TARGETARCH
WORKDIR /src
RUN apk --no-cache add git
RUN git clone https://codeberg.org/gothub/gothub .
RUN go mod download
RUN GOOS=linux GOARCH=$TARGETARCH go build -o /src/gothub -ldflags="-X codeberg.org/gothub/gothub/utils.Branch=dev"
FROM alpine:3.16 as bin
WORKDIR /app
COPY --from=build /src/gothub .
COPY --from=build /src/views ./views
COPY --from=build /src/public ./public
ENV DOCKER true
EXPOSE 3000
CMD ["/app/gothub", "serve"]