Skip to content

Commit

Permalink
update docker build command
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc authored and dustinxie committed Jan 5, 2023
1 parent 5d4e409 commit 2476e19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ COPY go.sum .
RUN go mod download

COPY . .

ARG PACKAGE_VERSION
ARG PACKAGE_COMMIT_ID
ARG GIT_STATUS
RUN mkdir -p $GOPATH/pkg/linux_amd64/github.com/iotexproject/ && \
make clean build-all
PACKAGE_VERSION=$PACKAGE_VERSION PACKAGE_COMMIT_ID=$PACKAGE_COMMIT_ID GIT_STATUS=$GIT_STATUS make clean build-all

FROM alpine

Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ ROOT_PKG := "github.com/iotexproject/iotex-core"
DOCKERCMD=docker

# Package Info
ifndef PACKAGE_VERSION
PACKAGE_VERSION := $(shell git describe --tags)
endif
ifndef PACKAGE_COMMIT_ID
PACKAGE_COMMIT_ID := $(shell git rev-parse HEAD)
endif
ifndef GIT_STATUS
GIT_STATUS := $(shell git status --porcelain)
ifdef GIT_STATUS
GIT_STATUS := "dirty"
GIT_STATUS := "dirty"
else
GIT_STATUS := "clean"
GIT_STATUS := "clean"
endif
endif
GO_VERSION := $(shell go version)
BUILD_TIME=$(shell date +%F-%Z/%T)
Expand Down
2 changes: 2 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker build --build-arg PACKAGE_COMMIT_ID=$SOURCE_COMMIT --build-arg PACKAGE_VERSION=$DOCKER_TAG --build-arg GIT_STATUS=clean -f $DOCKERFILE_PATH -t $IMAGE_NAME .

0 comments on commit 2476e19

Please sign in to comment.