From 97c5ce0b7bd2e5188859884500b8e3911a005792 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:07:35 +0200 Subject: [PATCH] use golang builder update ci --- .dockerignore | 4 ++++ .woodpecker.yml | 14 +++++++++++++- Dockerfile | 11 +++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ebb2139 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +/capture +/.woodpecker.yml +/.git +/.gitignore diff --git a/.woodpecker.yml b/.woodpecker.yml index ebd4e3d..e7b6660 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -15,7 +15,7 @@ pipeline: commands: - go build -o /artifacts/capture - push-release: + push_release: image: plugins/gitea-release volumes: *volumes settings: @@ -26,3 +26,15 @@ pipeline: files: /artifacts/capture when: event: [tag] + + docker_build_push: + image: docker:dind + secrets: + - registry_user + - registry_password + commands: + - echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin + - docker build -t deblan/capture:$TAG . + - docker push deblan/capture:$TAG + when: + event: [deployment] diff --git a/Dockerfile b/Dockerfile index 4db19a3..87173ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,12 @@ +FROM golang:1.19 as builder + +WORKDIR /src +COPY . . +RUN go build + FROM debian:stable-slim RUN apt-get update && apt-get install ca-certificates -y - -COPY ./capture /usr/bin/capture - -WORKDIR /app +COPY --from=builder /src/capture /usr/bin/capture ENTRYPOINT ["/usr/bin/capture"]