Skip to content

Commit 12e3dcd

Browse files
Galileyrclsilver
authored andcommitted
keep utask version while using the Makefile inside the Docker image
Signed-off-by: Wesley GALIPO <wesley.galipo@ovhcloud.com>
1 parent 814b9f0 commit 12e3dcd

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ FROM golang:1.20
1010

1111
COPY . /go/src/github.com/ovh/utask
1212
WORKDIR /go/src/github.com/ovh/utask
13-
RUN make re && \
14-
mv hack/Makefile-child Makefile && \
13+
RUN make re && make makefile && \
1514
mkdir -p /app/plugins /app/templates /app/config /app/init /app/static/dashboard && \
1615
mv hack/wait-for-it/wait-for-it.sh /wait-for-it.sh && \
17-
chmod +x /wait-for-it.sh
16+
chmod +x /wait-for-it.sh && \
17+
go clean -cache && rm -rf /go/pkg/*
1818
WORKDIR /app
1919

2020
COPY --from=js-builder /home/node/ui/dashboard/dist/utask-ui/ /app/static/dashboard/

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ifndef VERSION
1515
VERSION = $(shell git describe --abbrev=3 --tags $(git rev-list --tags --max-count=1))-dev
1616
endif
1717

18-
LAST_COMMIT = `git rev-parse HEAD`
18+
LAST_COMMIT := $(shell git rev-parse HEAD)
1919
VERSION_PKG = github.com/ovh/utask
2020

2121
DOCKER = 0
@@ -93,4 +93,7 @@ endif
9393

9494
package:
9595

96-
.PHONY: all clean test re package release test test-travis test-docker run-test-stack run-test-stack-docker run-goreleaser docker
96+
makefile:
97+
sed -e 's/VERSION=/VERSION=${VERSION}/g' hack/Makefile-child | sed -e 's/LAST_COMMIT=/LAST_COMMIT=${LAST_COMMIT}/g' >| Makefile
98+
99+
.PHONY: all clean test re package release test test-travis test-docker run-test-stack run-test-stack-docker run-goreleaser docker makefile

hack/Makefile-child

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
LAST_COMMIT=
2+
VERSION=
3+
14
all:
25
GO111MODULE=on go get -d -v ./...
3-
GO111MODULE=on go build -o utask ./cmd/utask
6+
GO111MODULE=on go build -ldflags "-X github.com/ovh/utask.Commit=${LAST_COMMIT} -X github.com/ovh/utask.Version=${VERSION}" -o utask ./cmd/utask
47
for p in $$(ls ./plugins); do if [ -d ./plugins/$$p ]; then GO111MODULE=on go build --buildmode=plugin -o ./plugins/$$p.so ./plugins/$$p/*.go; fi; done
58
for p in $$(ls ./init); do if [ -d ./init/$$p ]; then GO111MODULE=on go build --buildmode=plugin -o ./init/$$p.so ./init/$$p/*.go; fi; done
69

0 commit comments

Comments
 (0)