mirror of
https://github.com/wneessen/apg-go.git
synced 2024-12-22 19:20:39 +01:00
Modify Docker build process and workflow
The Docker build command in the GitHub workflow file (docker.yml) now requires sudo privileges. Additionally, the Dockerfile has been expanded to not only tidy up and verify the Go modules project but also to alter the build path for the "apg-go" executable.
This commit is contained in:
parent
7da9c71983
commit
48a0b6763b
2 changed files with 6 additions and 3 deletions
|
@ -19,7 +19,7 @@ jobs:
|
|||
run: |
|
||||
apt-get update; apt-get -y install docker; which docker
|
||||
- name: Build the Docker image
|
||||
run: docker build --no-cache --force-rm -t apg-go:main .
|
||||
run: sudo docker build --no-cache --force-rm -t apg-go:main .
|
||||
test:
|
||||
runs-on: docker
|
||||
steps:
|
||||
|
|
|
@ -3,8 +3,11 @@ FROM golang:latest AS builder
|
|||
RUN mkdir /builddir
|
||||
ADD . /builddir/
|
||||
WORKDIR /builddir
|
||||
RUN go mod tidy
|
||||
RUN go mod download
|
||||
RUN go mod verify
|
||||
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-w -s -extldflags "-static"' -o apg-go \
|
||||
github.com/wneessen/apg-go/cmd/apg
|
||||
src.neessen.cloud/wneessen/apg-go/cmd/apg
|
||||
|
||||
## Create scratch image
|
||||
FROM scratch
|
||||
|
@ -17,4 +20,4 @@ COPY --chown=apg-go ["README.md", "/apg-go/README.md"]
|
|||
COPY --from=builder --chown=apg-go ["/builddir/apg-go", "/apg-go/apg-go"]
|
||||
WORKDIR /apg-go
|
||||
USER apg-go
|
||||
ENTRYPOINT ["/apg-go/apg-go"]
|
||||
ENTRYPOINT ["/apg-go/apg-go"]
|
||||
|
|
Loading…
Reference in a new issue