ci: migrate from GitLab CI to Gitea Actions
- Add Gitea Actions workflow (.gitea/workflows/ci.yaml) - Update K8s deployment image registry to oci.unbound.se
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
name: geo-service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
BUILDTOOLS_CONTENT: ${{ secrets.BUILDTOOLS_CONTENT }}
|
||||||
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: buildtool/setup-buildtools-action@v1
|
||||||
|
- name: Test registry connectivity
|
||||||
|
run: curl -I https://oci.unbound.se/v2/
|
||||||
|
- name: Test docker login
|
||||||
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login oci.unbound.se -u buildtools --password-stdin
|
||||||
|
- name: Show config
|
||||||
|
run: unset GITHUB_REPOSITORY_OWNER GITEA_TOKEN && env && build --config
|
||||||
|
- name: Build and push
|
||||||
|
run: |
|
||||||
|
unset GITHUB_REPOSITORY_OWNER GITEA_TOKEN
|
||||||
|
echo "GITEA_TOKEN after unset: '${GITEA_TOKEN:-unset}'"
|
||||||
|
build --verbose && push --verbose
|
||||||
|
|
||||||
|
deploy-prod:
|
||||||
|
needs: build
|
||||||
|
if: gitea.ref == 'refs/heads/master'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
BUILDTOOLS_CONTENT: ${{ secrets.BUILDTOOLS_CONTENT }}
|
||||||
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||||
|
environment: prod
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: buildtool/setup-buildtools-action@v1
|
||||||
|
- name: Deploy
|
||||||
|
run: deploy prod
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
FROM amd64/golang:1.25.5@sha256:ad03ba93327b8a6143b49373790b5d92c28067bdb814418509466122ee9c9e63 as builder
|
||||||
|
WORKDIR /src
|
||||||
|
COPY * ./
|
||||||
|
RUN go get
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o geo-service .
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
|
COPY --from=builder /src/geo-service /
|
||||||
|
CMD ["/geo-service"]
|
||||||
+1
-1
@@ -41,7 +41,7 @@ spec:
|
|||||||
requests:
|
requests:
|
||||||
memory: "100Mi"
|
memory: "100Mi"
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
image: registry.gitlab.com/unboundsoftware/dancefinder/geo-service:${COMMIT}
|
image: oci.unbound.se/unboundsoftware/dancefinder/geo-service:${COMMIT}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
name: http
|
name: http
|
||||||
|
|||||||
Reference in New Issue
Block a user