diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..eabca0d --- /dev/null +++ b/.drone.yml @@ -0,0 +1,40 @@ +--- +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 + +--- +kind: signature +hmac: af032206e6fe57ddf4bee365bc616c3d8936973e0aa51e162a662f8026848422 + +... 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 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 ``` -