docker without makefile

This commit is contained in:
Kwitsch 2022-09-14 13:53:13 +02:00
parent 7e8431370b
commit c268e42738
2 changed files with 10 additions and 4 deletions

View File

@ -9,4 +9,5 @@ node_modules
.vscode
.gitignore
*.md
LICENSE
LICENSE
Makefile

View File

@ -33,17 +33,22 @@ RUN go mod download
# add source
ADD . .
RUN go generate ./...
# setup environment
ARG VERSION
ENV VERSION ${VERSION}
ARG BUILD_TIME
ENV BUILD_TIME ${BUILD_TIME}
ENV GO111MODULE=on
ENV CGO_ENABLED=0
# build binary
RUN --mount=type=cache,target=/root/.cache/go-build make build-static
RUN --mount=type=cache,target=/root/.cache/go-build \
go build \
-tags static \
-v \
-ldflags="-linkmode external -extldflags -static -X github.com/0xERR0R/blocky/util.Version=${VERSION} -X github.com/0xERR0R/blocky/util.BuildTime=${BUILD_TIME}" \
-o /src/bin/blocky
RUN setcap 'cap_net_bind_service=+ep' /src/bin/blocky
RUN chown blocky /src/bin/blocky