Optimize CI

This commit is contained in:
video-prize-ranch 2022-06-03 18:45:14 -04:00
parent dea4a3e5f1
commit b5081f2c4d
No known key found for this signature in database
GPG Key ID: D8EAA4C5B12A7281
2 changed files with 8 additions and 8 deletions

View File

@ -16,13 +16,11 @@ docker:
- mkdir -p ~/.docker/cli-plugins
- wget -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.8.1/buildx-v0.8.1.linux-amd64
- chmod +x ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker context create mybuilder
- docker buildx create --use --name mybuilder mybuilder
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker buildx build --cache-from $CI_REGISTRY_IMAGE:latest --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE:latest .
- docker buildx build --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE:latest .
deploy:
image: alpine:latest
@ -32,4 +30,4 @@ deploy:
- apk update && apk --no-cache add curl
- wget -O - https://fly.io/install.sh | sh
script:
- /root/.fly/bin/flyctl deploy --no-cache --detach
- /root/.fly/bin/flyctl deploy --detach

View File

@ -1,11 +1,13 @@
FROM golang:alpine AS build
FROM --platform=$BUILDPLATFORM golang:alpine AS build
ARG TARGETARCH
WORKDIR /src
RUN apk --no-cache add git ca-certificates
RUN git clone https://codeberg.org/video-prize-ranch/rimgo .
RUN apk --no-cache add ca-certificates
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build
RUN GOOS=linux GOARCH=$TARGETARCH CGO_ENABLED=0 go build
FROM scratch as bin