<#6730 fix(runs/docker): enable CGO for go-sqlite3...
# flyte-github
a
#6730 fix(runs/docker): enable CGO for go-sqlite3 and include gen/go in bui… Pull request opened by WangWang0226 --- ## Tracking issue #6703 --- ## Why are the changes needed? The
runs
service Dockerfile build failed due to: 1. The previous
runs/Dockerfile
used an incorrect build path (
/workspace/runs/cmd/main.go
did not exist), because the entire repository was copied into
/workspace/runs
, resulting in a nested structure (
/workspace/runs/runs/cmd/main.go
). This caused a “directory not found” build error. 2. The
go.mod
file specifies a minimum Go version of 1.24.6, but the original Dockerfile used golang:1.21-alpine as the builder image. This version mismatch caused go mod download to fail with an error stating that the Go toolchain was too old. 3. The build context did not include
gen/go
files because of
.dockerignore
rules, leading to module import errors for
flyteidl2
. 4. Since the
go-sqlite3
driver depends on CGO, the image built with
CGO_ENABLED=0
could not initialize the SQLite database at runtime. --- ## What changes were proposed in this pull request? This PR fixes and improves the Docker build process for the runs component: • Updated
.dockerignore
• Now excludes
gen/
by default but re-includes
gen/go/**
to ensure generated proto Go files are available in the build context. • Updated
runs/Dockerfile
• Fixed COPY path to copy the entire repo to
/workspace
and build from
/workspace/runs
. • Upgraded Go base image to
golang:1.24.6-alpine
(to match
go.mod
requirement). • Installed
build-base
(includes
gcc
,
musl-dev
) to support CGO builds. • Enabled
CGO_ENABLED=1
and added build tag
"sqlite_omit_load_extension"
for security and SQLite compatibility. These updates ensure the image builds successfully and the service can connect to SQLite without runtime errors. --- ## How was this patch tested? 1. Verified Docker build completes successfully: docker build -f runs/Dockerfile -t flyte-v2-runs:test . 2. Verified service runs correctly and connects to SQLite: docker run --rm -p "8090:8090" flyte-v2-runs:test --config /app/config.yaml 3. Confirmed health check endpoint responds successfully at
/healthz
.
Copy code
curl <http://localhost:8090/healthz>
All tests passed as expected. --- ### Labels • fixed • changed --- ### Setup process To rebuild the image locally: docker build -f runs/Dockerfile -t flyte-v2-runs:test . docker run --rm -p 8090:8090 flyte-v2-runs:test --config /app/config.yaml --- ### Screenshots • docker build & docker run [image](https://private-user-images.githubusercontent.com/55576734/512988668-d8fbc42e-a00d-4bd4-9f9e-39d7efa6234f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM2MTA4MTIsIm5iZiI6MTc2MzYxMDUxMiwicGF0aCI6Ii81NTU3NjczNC81MTI5ODg2NjgtZDhmYmM0MmUtYTAwZC00YmQ0LTlmOWUtMzlkN2VmYTYyMzRmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTExMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUxMTIwVDAzNDgzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMwZjQ5NDQ5NDVhZWVmMTJlMzI4YTQ5Y2JlZjNhZGM1OTIxZTlhNzJjMzdmZTM0MTMyY2Y4YzRiMDM3MjExZDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.-YjQ96yeSbnCXG2IYNLG9dmSeeUXX0g6lAZL34H7sLU) • curl http://localhost:8090/healthz [image](https://private-user-images.githubusercontent.com/55576734/512988856-0841f7c6-c4eb-4e01-bbc8-a0b532188e5b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjM2MTA4MTIsIm5iZiI6MTc2MzYxMDUxMiwicGF0aCI6Ii81NTU3NjczNC81MTI5ODg4NTYtMDg0MWY3YzYtYzRlYi00ZTAxLWJiYzgtYTBiNTMyMTg4ZTViLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTExMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUxMTIwVDAzNDgzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAwNTVmZDI5MWFhYzc0M2MxNjMyMDI3NjliNTg1NDVjMjJjNGZjM2Y3ZjExYzEzOWJkNjNkZmE2ZWFkNzNiMjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.yLCBooNZ_4yCQDNbTwdIg6y6hAbh5uIX_6lZ1_ItD3Y) --- ### Checklist • I updated the
.dockerignore
to include generated Go code. • I confirmed the new Docker image builds successfully. • All commits are signed-off. --- ## Related PRs N/A --- ## Docs link N/A --- flyteorg/flyte