Skip to content

Commit

Permalink
fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
childe committed Aug 15, 2024
1 parent 5857495 commit 8ce298b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
driver-opts: network=host

- name: Login to docker hub
- name: Login to docker hub
uses: docker/login-action@v2
with:
registry: docker.io
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM 1.22.5-alpine3.20 as build
FROM golang:1.22.5-alpine3.20 as build

RUN apk update && apk add make

Expand Down
13 changes: 2 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
hash:=$(shell git rev-parse --short HEAD)
tag?=$(hash)

.PHONY: gohangout all clean check test docker linux-binary
.PHONY: gohangout all clean check test docker

gohangout:
CGO_ENABLED=0 go build -ldflags "-X main.version=$(hash)" -o gohangout

linux-binary:
mkdir -p build
@echo "Building gohangout binary in docker container"
@if [ -n "$(GOPATH)" ]; then\
docker run -e CGO_ENABLED=0 -v $(GOPATH):/go -v $(PWD):/gohangout -w /gohangout golang:1.22 go build -ldflags "-X main.version=$(hash)" -o build/gohangout;\
else\
docker run -e CGO_ENABLED=0 -v $(PWD):/gohangout -w /gohangout golang:1.22 go build -ldflags "-X main.version=$(hash)" -o build/gohangout;\
fi

docker: linux-binary
docker:
docker build -t gohangout .

all: check
Expand Down

0 comments on commit 8ce298b

Please sign in to comment.