From 2c9e76bca25e3858e809492d762d6524766b7d55 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sat, 10 Dec 2022 15:37:28 +0100 Subject: [PATCH 1/4] Dockerfile and drone config for build & publish to ghcr --- .drone.yml | 39 +++++++++++++++++++++++++++++++++++++++ Dockerfile | 21 +++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..ca70e5b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,39 @@ +--- +kind: pipeline +type: docker +name: Build and publish + +platform: + os: linux + arch: amd64 + +steps: + - name: build + image: golang + commands: + - make build + + - name: Build and publish docker image + image: plugins/docker + settings: + registry: ghcr.io + repo: ghcr.io/kevinmidboe/planetposen-images + dockerfile: Dockerfile + username: + from_secret: GITHUB_USERNAME + password: + from_secret: GITHUB_PASSWORD + tags: latest + when: + event: + include: + - push + exclude: + - pull_request + branch: + - main + - feat/drone-ci-setup + +--- +kind: signature +hmac: 13d584e973017ab053c389c87d797deb78ea0c85c348446c7e5c1e3e8a174bc3 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b1567c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Build the project +FROM golang:1.19 as builder + +LABEL org.opencontainers.image.source="https://github.com/KevinMidboe/planetposen-images" + +WORKDIR /go/src/github.com/kevinmidboe/planetposen-images +ADD . . + +RUN make build +# RUN make test + +# Create production image for application with needed files +FROM golang:1.19-alpine + +EXPOSE 8000 + +RUN apk add --no-cache ca-certificates + +COPY --from=builder /go/src/github.com/kevinmidboe/planetposen-images . + +CMD ["./main"] \ No newline at end of file From afc9852d47771604d2b87ecacb6b527ddb1a93a0 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sat, 10 Dec 2022 15:41:34 +0100 Subject: [PATCH 2/4] Sign drone config file --- .drone.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index ca70e5b..22abae8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,4 +36,6 @@ steps: --- kind: signature -hmac: 13d584e973017ab053c389c87d797deb78ea0c85c348446c7e5c1e3e8a174bc3 +hmac: 8b78559987b3213bc139f7f299ce74e46967fd3a1d7386c264e6c403ccda03ca + +... From 12413eac1e127041681ede9ace1abfea51a4a2fb Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sat, 10 Dec 2022 15:44:02 +0100 Subject: [PATCH 3/4] Remove publishing from this branch --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 22abae8..eabca0d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -32,10 +32,9 @@ steps: - pull_request branch: - main - - feat/drone-ci-setup --- kind: signature -hmac: 8b78559987b3213bc139f7f299ce74e46967fd3a1d7386c264e6c403ccda03ca +hmac: af032206e6fe57ddf4bee365bc616c3d8936973e0aa51e162a662f8026848422 ... From aadb7f1d74f05c25d69feecf2cda7b3025883dcb Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sat, 10 Dec 2022 15:47:10 +0100 Subject: [PATCH 4/4] Removed trailing whitespace from readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 6ba14af..d4d819c 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,3 @@ or ```bash (sudo) docker run -d --name planetposen-images -p 8000:8000 --env-file .env planetposen-images ``` -