diff --git a/.tangled/workflows/build.yml b/.tangled/workflows/build.yml index de32976..3737612 100644 --- a/.tangled/workflows/build.yml +++ b/.tangled/workflows/build.yml @@ -28,14 +28,20 @@ steps: - name: "Build and push container image" command: | + set -e # Exit on error + # Create a container from distroless base + echo "Creating container from distroless base..." container=$(buildah --storage-driver vfs from gcr.io/distroless/cc-debian12:nonroot) + echo "Container ID: $container" # Copy the binaries + echo "Copying binaries..." buildah --storage-driver vfs copy $container target/release/grain /app/grain buildah --storage-driver vfs copy $container target/release/grainctl /app/grainctl # Set configuration + echo "Configuring container..." buildah --storage-driver vfs config --workingdir /app $container buildah --storage-driver vfs config --env RUST_LOG=info $container buildah --storage-driver vfs config --port 8888 $container @@ -47,9 +53,17 @@ steps: buildah --storage-driver vfs config --label "org.opencontainers.image.version=${TANGLED_COMMIT_SHA:0:7}" $container # Commit the container to an image + echo "Committing image..." buildah --storage-driver vfs commit $container grain:latest # Login and push to Docker Hub + echo "Logging in to Docker Hub..." echo "$DOCKER_PASS" | buildah --storage-driver vfs login --username "$DOCKER_USER" --password-stdin docker.io + + echo "Pushing image to docker.io/pierrelf/grain:latest..." buildah --storage-driver vfs push grain:latest docker://docker.io/pierrelf/grain:latest + + echo "Pushing image to docker.io/pierrelf/grain:${TANGLED_COMMIT_SHA:0:7}..." buildah --storage-driver vfs push grain:latest docker://docker.io/pierrelf/grain:${TANGLED_COMMIT_SHA:0:7} + + echo "Build and push completed successfully!"