diff --git a/.github/workflows/docker_build_mothd.yml b/.github/workflows/docker_build_mothd.yml index 63b8aaa..c06fbd2 100644 --- a/.github/workflows/docker_build_mothd.yml +++ b/.github/workflows/docker_build_mothd.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index 1205490..3def45a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ]