From bed03dd1eeaca5bef6920818538298fc41e2ba7b Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 4 Jun 2024 00:49:35 -0700 Subject: [PATCH] ci --- .gitea/workflows/build-image.yml | 60 +++++++++++++++++--------------- Dockerfile | 8 ++--- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml index 6c16a19..b2b8d3f 100644 --- a/.gitea/workflows/build-image.yml +++ b/.gitea/workflows/build-image.yml @@ -1,33 +1,35 @@ name: build image on: - push: - branches: - - master + push: + branches: + - master jobs: - build image: - runs-on: ubuntu-latest - container: - image: catthehacker/ubuntu:act-latest - steps: - - name: code checkout - uses: actions/checkout@v3 - - name: docker login - uses: docker/login-action@v2 - with: - registry: registry.digitalocean.com - username: ${{ secrets.DOCKER_REGISTRY_CREDS }} - password: ${{ secrets.DOCKER_REGISTRY_CREDS }} - - name: create tag - id: create-tag - run: | - tag=$(echo ${{ github.sha }} | cut -b 1-8) - echo "::set-output name=tag::$tag" - - name: build and push - uses: docker/build-push-action@master - with: - platforms: linux/amd64 - push: true - tags: | - registry.digitalocean.com/ssdocker/${{ github.repository }}:${{ steps.create-tag.outputs.tag }} - registry.digitalocean.com/ssdocker/${{ github.repository }}:latest + build image: + runs-on: ubuntu-latest + steps: + - name: code checkout + uses: actions/checkout@v4.1.6 + - name: docker login + uses: docker/login-action@v2 + with: + registry: registry.digitalocean.com + username: ${{ secrets.DOCKER_REGISTRY_CREDS }} + password: ${{ secrets.DOCKER_REGISTRY_CREDS }} + - name: create tag + id: create-tag + run: | + tag=$(echo ${{ github.sha }} | cut -b 1-8) + echo "::set-output name=tag::$tag" + - name: build and push + uses: docker/build-push-action@v5.3.0 + with: + platforms: linux/amd64 + push: true + build-args: | + REGISTRY_DOCKER_HUB=${{ vars.REGISTRY_DOCKER_HUB }} + REGISTRY_GCR=${{ vars.REGISTRY_GCR }} + REGISTRY_SIMPLE_SYSTEMS=${{ vars.REGISTRY_SIMPLE_SYSTEMS }} + tags: | + registry.digitalocean.com/ssdocker/${{ github.repository }}:${{ steps.create-tag.outputs.tag }} + registry.digitalocean.com/ssdocker/${{ github.repository }}:latest diff --git a/Dockerfile b/Dockerfile index 727a29e..31f4059 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ -# STEP 1: Build the website's files -FROM alpine:latest AS build-website +ARG REGISTRY_DOCKER_HUB +ARG REGISTRY_SIMPLE_SYSTEMS +FROM $REGISTRY_DOCKER_HUB/alpine:latest AS build-website WORKDIR /src @@ -12,8 +13,7 @@ RUN apk update && apk upgrade && \ RUN hugo --minify -# STEP 2: Add static files to webserver image -FROM registry.digitalocean.com/ssdocker/simplesystems/static-web-server:latest +FROM $REGISTRY_SIMPLE_SYSTEMS/simplesystems/static-web-server:609f2b47 WORKDIR /app