I am trying to build my first Dockerfile for a Go application and use DroneCI to build pipeline.
The DroneCI configuration looks as follows:
kind: pipeline
type: docker
name: Build auto git tagger
steps:
- name: test and build
image: golang
commands:
- go mod download
- go test ./test
- go build ./cmd/git-tagger
- name: Build docker image
image: plugins/docker
pull: if-not-exists
settings:
username:
password:
repo:
dockerfile: ./build/ci/Dockerfile
registry:
auto_tag: true
trigger:
branch:
- master
I have followed the structure convention from https://github.com/golang-standards/project-layout:
The Dockerfile looks as follows so far:
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
The next step is, to copy the GO application binary into the container and here is the question, where to put the compiled binary? At the moment, it puts into the project folder.