From b839b5503e5fc8583c6f4d445f9a6943f1ad7a2c Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Tue, 28 Jan 2025 21:01:36 -0600 Subject: [PATCH] build docker and update go and alpine versions --- .drone.star.yml | 19 ++++++- .drone.yml | 2 +- Dockerfile | 4 +- scripts/drone/pipelines/test_and_build.star | 56 ++++++++++++++++++--- 4 files changed, 69 insertions(+), 12 deletions(-) diff --git a/.drone.star.yml b/.drone.star.yml index 9a68294bd..5bed2d261 100644 --- a/.drone.star.yml +++ b/.drone.star.yml @@ -13,6 +13,16 @@ steps: - git fetch --tags image: alpine/git name: fetch +- commands: + - sleep 10 + - ls -l /var/run/docker.sock + - test -S /var/run/docker.sock && echo 'Docker socket found' || echo 'Docker socket + missing' + image: alpine + name: debug_dind + volumes: + - name: dockersock + path: /var/run - commands: - ./scripts/go-test.sh environment: @@ -32,7 +42,14 @@ steps: GOPROXY: http://goproxy image: golang:1.23.5-alpine3.20 name: build +- commands: + - docker build -t publicawesome/stargaze:latest . + image: docker:24 + name: build_docker + volumes: + - name: dockersock + path: /var/run type: docker volumes: - name: dockersock - path: /var/run + temp: {} diff --git a/.drone.yml b/.drone.yml index 248e54dd3..0293a1e40 100644 --- a/.drone.yml +++ b/.drone.yml @@ -424,6 +424,6 @@ volumes: --- kind: signature -hmac: 3f3de8b4a74ad66ba3729c9ba7799d2ca37680d68376ca8ce61faf11ac1c049b +hmac: af1d0bc62183b8e4e5701a0ad3eefa0d6eab0719a8d3805152dfdd6cdd0d4578 ... diff --git a/Dockerfile b/Dockerfile index 06f877aea..d053d9018 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # docker build . -t publicawesome/stargaze:latest # docker run --rm -it publicawesome/stargaze:latest /bin/sh -FROM golang:1.23.5-alpine3.19 AS go-builder +FROM golang:1.23.5-alpine3.20 AS go-builder RUN set -eux; apk add --no-cache ca-certificates build-base git; @@ -26,7 +26,7 @@ RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build # -------------------------------------------------------- -FROM alpine:3.19 +FROM alpine:3.20 COPY --from=go-builder /code/bin/starsd /usr/bin/starsd RUN apk add -U --no-cache ca-certificates diff --git a/scripts/drone/pipelines/test_and_build.star b/scripts/drone/pipelines/test_and_build.star index d091fc13f..53ac68d6b 100644 --- a/scripts/drone/pipelines/test_and_build.star +++ b/scripts/drone/pipelines/test_and_build.star @@ -3,6 +3,8 @@ go_dev_image = "publicawesome/golang:1.23.5-devtooling" go_image = "golang:1.23.5-alpine3.20" wasmvm_version = "v2.1.4" wasmvm_x86_84_hash = "a4a3d09b36fabb65b119d5ba23442c23694401fcbee4451fe6b7e22e325a4bac" +docker_image = "docker:24" +docker_dind_image = "docker:dind" def pipeline_test_and_build(ctx): return { @@ -11,11 +13,14 @@ def pipeline_test_and_build(ctx): "name": "test_and_build", "steps": [ step_fetch(ctx), + step_debug_dind(ctx), step_test(ctx), step_build(ctx), + step_build_docker(ctx), + ], "volumes": [ - volume_dockersock(ctx) + create_volume_dockersock(ctx) ], "services": [ service_dind(ctx) @@ -61,21 +66,56 @@ def step_build(ctx): } +def step_build_docker(ctx): + return { + "name": "build_docker", + "image": docker_image, + "commands": [ + "docker build -t publicawesome/stargaze:latest ." + ], + "volumes": [ + mount_volume(ctx, "dockersock", "/var/run") + ] + } + +def step_debug_dind(ctx): + return { + "name": "debug_dind", + "image": "alpine", + "commands": [ + "sleep 10", + "ls -l /var/run/docker.sock", + "test -S /var/run/docker.sock && echo 'Docker socket found' || echo 'Docker socket missing'" + ], + "volumes": [ + mount_volume(ctx, "dockersock", "/var/run") + ] + } + def service_dind(ctx): return { "name": "dind", - "image": "docker:dind", + "image": docker_dind_image, "privileged": True, "volumes": [ - { - "name": "dockersock", - "path": "/var/run" - } + mount_volume(ctx, "dockersock", "/var/run") ] } -def volume_dockersock(ctx): +def mount_volume(ctx, name, path): + return { + "name": name, + "path": path + } + +def create_volume_dockersock(ctx): return { "name": "dockersock", - "path": "/var/run" + "temp": dict() + } + +def volume_docker_export(ctx): + return { + "name": "docker_export", + "path": "/containers/export" }