File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ name : Build and Push Container
3+
4+ on :
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ container-build-push :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Login to GitHub Container Registry
14+ uses : docker/login-action@v3
15+ with :
16+ registry : ghcr.io
17+ username : ${{ github.actor }}
18+ password : ${{ secrets.GITHUB_TOKEN }}
19+
20+ - name : Set up QEMU
21+ uses : docker/setup-qemu-action@v3
22+
23+ - name : Set up Docker Buildx
24+ uses : docker/setup-buildx-action@v3
25+
26+ - name : Build and Push Container
27+ uses : docker/build-push-action@v6
28+ with :
29+ file : Containerfile
30+ push : true
31+ tags : |
32+ ghcr.io/sudomateo/yeetcode:latest
33+ ghcr.io/sudomateo/yeetcode:${{ github.sha }}
34+ platforms : |
35+ linux/amd64
36+ linux/arm64
Original file line number Diff line number Diff line change 1+ FROM golang:1.24.0 AS builder
2+
3+ ARG TARGETARCH
4+
5+ WORKDIR /app
6+ COPY go.mod go.sum .
7+ RUN go mod download
8+
9+ COPY . .
10+ RUN CGO_ENABLED=0 go build -v -trimpath -ldflags='-extldflags=-static -w -s' .
11+
12+ FROM debian:bookworm-slim
13+
14+ RUN apt-get update -y && apt-get install -y ca-certificates
15+
16+ COPY --from=builder /app/yeetcode /usr/bin/yeetcode
17+
18+ CMD ["yeetcode" ]
You can’t perform that action at this time.
0 commit comments