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..7292217 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,17 @@ 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:${CI_PIPELINE_DEPLOY_TARGET} ." + - "docker push deblan/capture:${CI_PIPELINE_DEPLOY_TARGET}" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + 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"] 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 |