diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 0000000..d5faad9 --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,19 @@ +name: Publish Docker image +on: + release: + types: [published] +jobs: + push_to_registry: + name: Push Docker image to GitHub Packages + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Push to GitHub Packages + uses: docker/build-push-action@v1 + with: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + repository: camptocamp/cups_exporter + tag_with_ref: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8c5b87a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.13 as builder + +WORKDIR /build +ADD . /build +RUN go build -o cups_exporter main.go + +FROM golang:1.13 + +LABEL maintainer="lenny.consuegra@camptocamp.com" + +ENV CUPS_URI "https://localhost:631" + +COPY --from=builder /build/cups_exporter /bin/cups_exporter + +EXPOSE 9329 + +CMD [ "/bin/sh", "-c", "/bin/cups_exporter -cups.uri ${CUPS_URI}" ]