Add Docker configuration

This commit is contained in:
2021-03-06 15:11:40 +00:00
parent e1953f339d
commit ec9e6ca83c
3 changed files with 33 additions and 0 deletions

21
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Build
on:
push:
branches: main
jobs:
build:
name: GitHub Package Registry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Package Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u luketainton --password-stdin
- name: Build image for GitHub Package Registry
run: |
docker build . --file Dockerfile --tag docker.pkg.github.com/luketainton/ipilot/ipilot:latest
docker build . --file Dockerfile --tag docker.pkg.github.com/luketainton/ipilot/ipilot:$GITHUB_SHA
- name: Push image to GitHub Package Registry
run: |
docker push docker.pkg.github.com/luketainton/ipilot/ipilot:latest
docker push docker.pkg.github.com/luketainton/ipilot/ipilot:$GITHUB_SHA

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM golang:1.16-alpine as build
WORKDIR /go/src/app
COPY . /go/src/app
RUN CGO_ENABLED=0 go build -o /go/bin/app
FROM gcr.io/distroless/base-debian10
LABEL maintainer="Luke Tainton <luke@tainton.uk>"
COPY --from=build /go/bin/app /
CMD ["/app"]

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/luketainton/iPilot
go 1.16