Browse Source

Add Dockerfile for building

master
Peter Stuifzand 2 years ago
parent
commit
590094cdbb
  1. 6
      .drone.yml
  2. 13
      Dockerfile

6
.drone.yml

@ -9,3 +9,9 @@ pipeline:
- go get ./...
- go test
- go vet
publish:
image: plugins/docker
repo: registry.stuifzandapp.com/track-me
registry: registry.stuifzandapp.com
secrets: [ docker_username, docker_password ]

13
Dockerfile

@ -1,8 +1,15 @@
FROM alpine
# build stage
FROM golang:1.12-alpine3.9 AS build-env
RUN apk --no-cache add git
WORKDIR /go/src/p83.nl/go/track-me
ADD . /go/src/p83.nl/go/track-me
RUN go get && go build
FROM alpine:3.9
RUN addgroup -S app && adduser -S -G app app
RUN apk add --update ca-certificates
WORKDIR /data
RUN ["chown", "app:app", "/data"]
COPY track-me /app/
COPY --from=build-env /go/bin/track-me /app/
USER app
CMD ["/app/track-me"]
ENTRYPOINT ["/app/track-me"]
Loading…
Cancel
Save