build on gitea action
This commit is contained in:
parent
fb24b978be
commit
5aec831956
43
.gitea/workflows/container-build.yaml
Normal file
43
.gitea/workflows/container-build.yaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: build container
|
||||||
|
|
||||||
|
run-name: build container on ${{ gitea.actor }}
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
env:
|
||||||
|
GOPROXY: ${{ vars.GOPROXY }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: bookworm
|
||||||
|
steps:
|
||||||
|
- name: Setup apt mirror
|
||||||
|
run: sed -i "s,deb.debian.org,${{ vars.DEBIAN_MIRROR }},g" ${{ vars.DEBIAN_APT_SOURCES }}
|
||||||
|
if: ${{ vars.DEBIAN_MIRROR && vars.DEBIAN_APT_SOURCES }}
|
||||||
|
- name: Setup Debian environment
|
||||||
|
run: apt update && apt install -y nodejs
|
||||||
|
- name: Setup Golang
|
||||||
|
uses: actions/setup-go
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -v ./...
|
||||||
|
|
||||||
|
build-container:
|
||||||
|
runs-on: bookworm
|
||||||
|
needs:
|
||||||
|
- test
|
||||||
|
steps:
|
||||||
|
- name: Setup apt mirror
|
||||||
|
run: sed -i "s,deb.debian.org,${{ vars.DEBIAN_MIRROR }},g" ${{ vars.DEBIAN_APT_SOURCES }}
|
||||||
|
if: ${{ vars.DEBIAN_MIRROR && vars.DEBIAN_APT_SOURCES }}
|
||||||
|
- name: Setup debian environment
|
||||||
|
run: apt update && apt install -y podman podman-compose nodejs
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Build container
|
||||||
|
run: REGISTRY=${{ github.server_url}}; REGISTRY=${REGISTRY##https://}; REGISTRY=${REGISTRY##http://}; podman build -t $REGISTRY/${{ github.repository }} .
|
||||||
|
- name: Login to Container Registry
|
||||||
|
run: echo "${{ secrets.ACTION_PACKAGE_WRITE_TOKEN }}" | podman login ${{ github.server_url }} -u ${{ github.repository_owner }} --password-stdin
|
||||||
|
- name: Push Container Image
|
||||||
|
run: REGISTRY=${{ github.server_url}}; REGISTRY=${REGISTRY##https://}; REGISTRY=${REGISTRY##http://}; podman push --log-level=trace $REGISTRY/${{ github.repository }}
|
||||||
|
|
@ -1,7 +1,8 @@
|
|||||||
FROM docker.io/library/golang:1.23-alpine
|
FROM docker.io/library/golang:1.23-alpine
|
||||||
|
ARG GOPROXY
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN env GOPROXY=${GOPROXY:-direct} go mod download
|
||||||
ADD . /src
|
ADD . /src
|
||||||
RUN go build -o /cache-proxy ./cmd/proxy
|
RUN go build -o /cache-proxy ./cmd/proxy
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
services:
|
services:
|
||||||
cache-proxy:
|
cache-proxy:
|
||||||
image: 100.64.0.2/guochao/cache-proxy:20250207
|
image: 100.64.0.2:3000/guochao/cache-proxy
|
||||||
build: .
|
build:
|
||||||
|
args:
|
||||||
|
GOPROXY: ${GOPROXY:-direct}
|
||||||
|
|
||||||
pull_policy: always
|
pull_policy: always
|
||||||
restart: always
|
restart: always
|
||||||
@ -16,4 +18,4 @@ services:
|
|||||||
- HTTP_PROXY=http://100.64.0.23:7890
|
- HTTP_PROXY=http://100.64.0.23:7890
|
||||||
- ALL_PROXY=http://100.64.0.23:7890
|
- ALL_PROXY=http://100.64.0.23:7890
|
||||||
- SENTRY_DSN=http://3b7336602c77427d96318074cd86ee04@100.64.0.2:8000/2
|
- SENTRY_DSN=http://3b7336602c77427d96318074cd86ee04@100.64.0.2:8000/2
|
||||||
- LOG_LEVEL=debug
|
- LOG_LEVEL=debug
|
||||||
|
Loading…
x
Reference in New Issue
Block a user