use golang builder

This commit is contained in:
Antoni Sawicki 2024-06-10 01:58:38 -07:00
parent 93e9fddca7
commit d8b4f160ac
2 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,14 @@
FROM golang as builder
WORKDIR /src
RUN git clone https://github.com/tenox7/wrp.git
WORKDIR /src/wrp
RUN go mod download
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o /wrp-${TARGETARCH}
FROM chromedp/headless-shell FROM chromedp/headless-shell
ARG TARGETARCH ARG TARGETARCH
ADD wrp-${TARGETARCH}-linux /wrp COPY --from=builder /wrp-${TARGETARCH} /wrp
ENTRYPOINT ["/wrp"] ENTRYPOINT ["/wrp"]
ENV PATH="/headless-shell:${PATH}" ENV PATH="/headless-shell:${PATH}"
LABEL maintainer="as@tenoware.com" LABEL maintainer="as@tenoware.com"

View File

@ -13,9 +13,10 @@ cross:
GOOS=linux GOARCH=arm go build -a -o wrp-arm-linux wrp.go GOOS=linux GOARCH=arm go build -a -o wrp-arm-linux wrp.go
GOOS=linux GOARCH=arm64 go build -a -o wrp-arm64-linux wrp.go GOOS=linux GOARCH=arm64 go build -a -o wrp-arm64-linux wrp.go
docker: wrp docker-local:
GOOS=linux GOARCH=amd64 go build -a -o wrp-amd64-linux wrp.go docker buildx build --platform linux/amd64,linux/arm64 -t tenox7/wrp:latest --load .
GOOS=linux GOARCH=arm64 go build -a -o wrp-arm64-linux wrp.go
docker-push:
docker buildx build --platform linux/amd64,linux/arm64 -t tenox7/wrp:latest --push . docker buildx build --platform linux/amd64,linux/arm64 -t tenox7/wrp:latest --push .
clean: clean: