From da854e27e1dd590b7eb8837b25d4c9ad370c3c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Tue, 13 Aug 2024 12:06:10 +0200 Subject: [PATCH] Fix version in the Docker CI Build (#1357) --- .dockerignore | 6 ++++++ Dockerfile | 11 ++++++----- Makefile | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..d3b92dfca --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git/ +/docker/* +.dockerignore +*.mp4 +*.ts +*Dockerfile* diff --git a/Dockerfile b/Dockerfile index 84e08a985..ea79acee9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM golang:1-bullseye as gobuild +FROM golang:1-bullseye AS gobuild -ARG TARGETARCH +ARG TARGETARCH WORKDIR /src @@ -8,11 +8,12 @@ ADD go.mod go.sum ./ RUN go mod download ADD . . -RUN make build ARG GIT_VERSION ENV GIT_VERSION="${GIT_VERSION}" +RUN make build GIT_VERSION="${GIT_VERSION}" + FROM ubuntu:22.04 AS catalyst ENV DEBIAN_FRONTEND=noninteractive @@ -30,6 +31,6 @@ RUN apt update && apt install -yqq \ vnstat \ && rm -rf /var/lib/apt/lists/* -COPY --from=gobuild /src/build/catalyst-api /bin/catalyst-api +COPY --from=gobuild /src/build/catalyst-api /bin/catalyst-api -CMD ["/bin/catalyst-api"] \ No newline at end of file +CMD ["/bin/catalyst-api"] diff --git a/Makefile b/Makefile index a1465e974..195cf45ea 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ GO_BUILD_DIR?=build/ -ldflags := -X 'github.com/livepeer/catalyst-api/config.Version=$(shell git rev-parse HEAD)' +GIT_VERSION?=$(shell git rev-parse HEAD) +ldflags := -X 'github.com/livepeer/catalyst-api/config.Version=$(GIT_VERSION)' .PHONY: all all: build fmt test lint integration-test tidy