-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.81 KB
/
build-rp-nginx-docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
name: Build Reverse Proxy NginX Docker Image
run-name: Build Reverse Proxy NginX Docker Image by @${{ github.actor }}
permissions:
id-token: write
contents: write
on:
workflow_dispatch:
jobs:
# ------------------------------------------------------------------------------
# set version
# ------------------------------------------------------------------------------
build-image:
name: prepare docker image
runs-on: ubuntu-latest
steps:
- name: set vars
id: variables
run: |
echo "version_no=$(date +%y%m%d).${{ github.run_number }}" >> "$GITHUB_OUTPUT"
prep_image_id=$(echo "ghcr.io/${{ github.repository_owner }}/web-rp-nginx" | tr '[A-Z]' '[a-z]')
echo "image_id=$prep_image_id" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: log in to registry
run: echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io --username ${{ github.actor }} --password-stdin
shell: bash
- name: build and push image
run: |
echo ${{ steps.variables.outputs.image_id }}
docker build \
--tag ${{ steps.variables.outputs.image_id }}:${{ steps.variables.outputs.version_no }} \
--build-arg "BUILD_VERSION=${{ steps.variables.outputs.version_no }}" \
--platform linux/amd64 \
--no-cache \
--file ./docker-builds/rp-nginx/docker-alpine-rp-nginx \
.
docker push ${{ steps.variables.outputs.image_id }}:${{ steps.variables.outputs.version_no }}
shell: bash
- name: tag latest
run: |
docker tag ${{ steps.variables.outputs.image_id }}:${{ steps.variables.outputs.version_no }} ${{ steps.variables.outputs.image_id }}:latest
docker push ${{ steps.variables.outputs.image_id }}:latest
shell: bash
...