From e544dedd6e29dba241c1935565ac99003af24f8b Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 10 Oct 2024 23:59:10 -0400 Subject: [PATCH] feat: build golang-ubuntu-latest image --- .gitea/workflows/push.yaml | 29 +++++++++++++++++++++++++++++ Dockerfile | 9 +++++++++ Makefile | 12 ++++++++++++ README.md | 1 + 4 files changed, 51 insertions(+) create mode 100644 .gitea/workflows/push.yaml create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 README.md diff --git a/.gitea/workflows/push.yaml b/.gitea/workflows/push.yaml new file mode 100644 index 0000000..c5430da --- /dev/null +++ b/.gitea/workflows/push.yaml @@ -0,0 +1,29 @@ +--- +name: push +on: + push: + branches: + - golang-ubuntu-latest +jobs: + build: + container: + image: focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest + steps: + - name: Check out repository code + uses: https://gitea.com/BoYanZh/checkout@focs + - name: Determine build command + id: build_command + run: | + if echo "${{ github.event.head_commit.message }}" | grep -q "force build"; then + echo "build_command=make force-build" >> $GITHUB_ENV + else + echo "build_command=make build" >> $GITHUB_ENV + fi + - name: Build + run: ${{ env.build_command }} + - name: Check images + run: docker images + - name: Remove dangling images + run: docker image prune -f + - name: Push + run: make push diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c762401 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM focs.ji.sjtu.edu.cn:5000/gitea/runner-images:ubuntu-latest + +ARG GO_VERSION=1.23.1 +ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin + +RUN wget -q https://studygolang.com/dl/golang/go${GO_VERSION}.linux-amd64.tar.gz && \ + rm -rf /usr/local/go && \ + tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \ + rm go${GO_VERSION}.linux-amd64.tar.gz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..50f328b --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +.PHONY: all force-build build push + +all: build + +force-build: + docker build --no-cache -t focs.ji.sjtu.edu.cn:5000/gitea/runner-images:golang-ubuntu-latest . + +build: + docker build -t focs.ji.sjtu.edu.cn:5000/gitea/runner-images:golang-ubuntu-latest . + +push: + docker push focs.ji.sjtu.edu.cn:5000/gitea/runner-images:golang-ubuntu-latest diff --git a/README.md b/README.md new file mode 100644 index 0000000..cb7a1a7 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Runner Images with Golang