Skip to content

Commit

Permalink
fix(make): build_docker_image failed (jeessy2#522)
Browse files Browse the repository at this point in the history
Looks like it fails after jeessy2#498 because it requires buildkit, add `DOCKER_BUILDKIT=1` to enable buildkit to fix this

Also, add `--no-cache` to `apk add` to not cache the index locally, forgot to do that in jeessy2#498.
  • Loading branch information
WaterLemons2k authored Feb 5, 2023
1 parent 4724613 commit 593f17c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /app
COPY . .
ARG TARGETOS TARGETARCH

RUN apk add git make tzdata \
RUN apk add --no-cache git make tzdata \
&& GOOS=$TARGETOS GOARCH=$TARGETARCH make clean build

# final stage
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`)
BIN=ddns-go
DIR_SRC=.
DOCKER_CMD=docker
DOCKER_ENV=DOCKER_BUILDKIT=1
DOCKER=$(DOCKER_ENV) docker

GO_ENV=CGO_ENABLED=0
GO_FLAGS=-ldflags="-X main.version=$(VERSION) -X 'main.buildTime=`date`' -extldflags -static -s -w" -trimpath
Expand All @@ -15,7 +16,7 @@ build: $(DIR_SRC)/main.go
@$(GO) build $(GO_FLAGS) -o $(BIN) $(DIR_SRC)

build_docker_image:
@$(DOCKER_CMD) build -f ./Dockerfile -t ddns-go:$(VERSION) .
@$(DOCKER) build -f ./Dockerfile -t ddns-go:$(VERSION) .

test:
@$(GO) test ./...
Expand Down

0 comments on commit 593f17c

Please sign in to comment.