From 97c5ce0b7bd2e5188859884500b8e3911a005792 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:07:35 +0200 Subject: [PATCH 1/7] 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"] From be35ef88096be35e8d22872ce23ace5ec903e355 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:09:47 +0200 Subject: [PATCH 2/7] fix ci vy adding volumes --- .woodpecker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index e7b6660..c3ad6a2 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -36,5 +36,7 @@ pipeline: - echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin - docker build -t deblan/capture:$TAG . - docker push deblan/capture:$TAG + volumes: + - /var/run/docker.sock:/var/run/docker.sock when: event: [deployment] From 3d9aeaf2d37fdddf66cd34869822a552199f533a Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:11:38 +0200 Subject: [PATCH 3/7] fix ci --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index c3ad6a2..38f9949 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -34,8 +34,8 @@ pipeline: - registry_password commands: - echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin - - docker build -t deblan/capture:$TAG . - - docker push deblan/capture:$TAG + - docker build -t deblan/capture:${TAG} . + - docker push deblan/capture:${TAG} volumes: - /var/run/docker.sock:/var/run/docker.sock when: From c5392885bd14a9344f5238fa5a85c5c7d54fe823 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:12:59 +0200 Subject: [PATCH 4/7] fix ci --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 38f9949..28ad0d1 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -34,8 +34,8 @@ pipeline: - registry_password commands: - echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin - - docker build -t deblan/capture:${TAG} . - - docker push deblan/capture:${TAG} + - "docker build -t deblan/capture:${TAG} ." + - "docker push deblan/capture:${TAG}" volumes: - /var/run/docker.sock:/var/run/docker.sock when: From 57654afc2dae5bdbd936733afd397ad7a30f1426 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:15:29 +0200 Subject: [PATCH 5/7] fix ci --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 28ad0d1..c3458ac 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -34,8 +34,8 @@ pipeline: - registry_password commands: - echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin - - "docker build -t deblan/capture:${TAG} ." - - "docker push deblan/capture:${TAG}" + - docker build -t deblan/capture:${CI_PIPELINE_DEPLOY_TARGET} . + - docker push deblan/capture:${CI_PIPELINE_DEPLOY_TARGET} volumes: - /var/run/docker.sock:/var/run/docker.sock when: From baf19d935c7ec41cda004d2ab7af489a16623798 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:15:49 +0200 Subject: [PATCH 6/7] fix ci --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index c3458ac..7292217 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -34,8 +34,8 @@ pipeline: - registry_password commands: - echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin - - docker build -t deblan/capture:${CI_PIPELINE_DEPLOY_TARGET} . - - docker push deblan/capture:${CI_PIPELINE_DEPLOY_TARGET} + - "docker build -t deblan/capture:${CI_PIPELINE_DEPLOY_TARGET} ." + - "docker push deblan/capture:${CI_PIPELINE_DEPLOY_TARGET}" volumes: - /var/run/docker.sock:/var/run/docker.sock when: From 989e7689fc838a7394ac7456a45f3c8d2302343f Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 6 Jun 2023 22:48:38 +0200 Subject: [PATCH 7/7] update documentation --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3314d2c..89957c7 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ Forked from [ofabricio/capture](https://github.com/ofabricio/capture). ./capture -url=https://example.com/ -port 9000 -dashboard 9001 -captures 16 ``` +Via docker: + +``` +docker run -p 9000:9000 -p 9001:9001 deblan/capture -url=https://example.com/ -port 9000 -dashboard 9001 -captures 16 +``` + #### Settings | param | description |