From 64881535f18ce08c35f51fe39c5592f343c141fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Va=C5=A1ko?= Date: Wed, 27 Nov 2024 08:34:33 +0100 Subject: [PATCH] fix: Build images with race. WIP create 2 types of images, one with race other without --- Makefile | 5 ++++- provisioning/apps-proxy/docker/Dockerfile | 2 +- provisioning/dev/docker/Dockerfile | 1 + provisioning/stream/docker/service/Dockerfile | 3 ++- provisioning/templates-api/docker/Dockerfile | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2684c17859..ead6038710 100644 --- a/Makefile +++ b/Makefile @@ -37,12 +37,15 @@ run-templates-api: build-stream-service: CGO_ENABLED=0 go build -v -mod mod -ldflags "-s -w" -o "$(or $(BUILD_TARGET_PATH), ./target/stream/service)" ./cmd/stream +build-stream-service-with-race: + CGO_ENABLED=1 go build -race -v -mod mod -ldflags "-s -w" -o "$(or $(BUILD_TARGET_PATH), ./target/stream/service)" ./cmd/stream + run-stream-service: rm -rf /tmp/stream-volumes && \ mkdir -p /tmp/stream-volumes/hdd/my-volume && \ air -c ./provisioning/stream/dev/.air.toml -run-stream-service-once: build-stream-service +run-stream-service-once: build-stream-service-with-race ./target/stream/service api http-source storage-writer storage-reader storage-coordinator build-apps-proxy: diff --git a/provisioning/apps-proxy/docker/Dockerfile b/provisioning/apps-proxy/docker/Dockerfile index d383b02f60..95f8ada544 100644 --- a/provisioning/apps-proxy/docker/Dockerfile +++ b/provisioning/apps-proxy/docker/Dockerfile @@ -15,7 +15,7 @@ COPY . . RUN make build-apps-proxy # Production container -FROM alpine:3.19 +FROM alpine:3.20 RUN apk add -U --no-cache ca-certificates git COPY --from=buildContainer /app/target/apps-proxy/proxy /app/server diff --git a/provisioning/dev/docker/Dockerfile b/provisioning/dev/docker/Dockerfile index c187810ea6..46ca53640b 100644 --- a/provisioning/dev/docker/Dockerfile +++ b/provisioning/dev/docker/Dockerfile @@ -18,6 +18,7 @@ COPY Makefile /tmp/build/Makefile COPY scripts /tmp/build/scripts RUN cd /tmp/build && make tools && cd / && rm -rf /tmp/build && go clean -cache -modcache RUN apt update && apt install -y graphviz +RUN apt-get install --no-install-recommends --assume-yes build-essential libsqlite3-0 # Install envsubstr and helm RUN curl -L https://github.com/a8m/envsubst/releases/download/v1.2.0/envsubst-$(uname -s)-$(uname -m) -o /usr/local/bin/envsubst && \ diff --git a/provisioning/stream/docker/service/Dockerfile b/provisioning/stream/docker/service/Dockerfile index ec46a95804..34d0295ef7 100644 --- a/provisioning/stream/docker/service/Dockerfile +++ b/provisioning/stream/docker/service/Dockerfile @@ -1,6 +1,7 @@ # Build container FROM golang:1.23.3-alpine3.20 AS buildContainer RUN apk add -U --no-cache bash make curl +RUN apk add --no-cache --update gcc g++ WORKDIR /app COPY Makefile Makefile @@ -15,7 +16,7 @@ COPY . . RUN make build-stream-service # Production container -FROM alpine:3.19 +FROM alpine:3.20 RUN apk add -U --no-cache ca-certificates git COPY --from=buildContainer /app/target/stream/service /app/service diff --git a/provisioning/templates-api/docker/Dockerfile b/provisioning/templates-api/docker/Dockerfile index 9b9b1e6ef9..72dd752126 100644 --- a/provisioning/templates-api/docker/Dockerfile +++ b/provisioning/templates-api/docker/Dockerfile @@ -15,7 +15,7 @@ COPY . . RUN make build-templates-api # Production container -FROM alpine:3.19 +FROM alpine:3.20 RUN apk add -U --no-cache ca-certificates git COPY --from=buildContainer /app/target/templates/api /app/server