Container image CI build

This commit is contained in:
Neale Pickett 2020-09-14 20:05:34 +00:00
parent 2391ebe27b
commit 81cbed3a94
2 changed files with 18 additions and 6 deletions

View File

@ -10,3 +10,11 @@ jobs:
uses: actions/checkout@v1
- name: Build mothd
run: docker build .
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: dirtbags/moth/moth
tag-with-ref: true

View File

@ -2,14 +2,18 @@ FROM golang:1.13 AS builder
COPY go.* /src/
COPY pkg /src/pkg/
COPY cmd /src/cmd/
COPY theme /target/theme/
COPY example-puzzles /target/puzzles/
COPY LICENSE.md /target/
WORKDIR /src/
#RUN go test ./...
RUN CGO_ENABLED=0 GOOS=linux go install -i -a -ldflags '-extldflags "-static"' ./...
RUN mkdir -p /target/bin
RUN cp /go/bin/* /target/bin/
FROM builder AS tester
RUN go test ./...
FROM scratch
COPY --from=builder /go/bin/* /usr/bin/
COPY theme /theme/
COPY example-puzzles /puzzles/
COPY LICENSE.md /LICENSE.md
COPY --from=builder /target /
ENTRYPOINT [ "/usr/bin/mothd" ]
ENTRYPOINT [ "/bin/mothd" ]