forked from pyodide/pyodide
-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (96 loc) · 3.39 KB
/
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: pyodide-env-docker
on:
workflow_dispatch:
inputs:
chrome_version:
description: "Version of the chrome browser (e.g. 109, 108, latest)."
required: false
default: "109"
firefox_version:
description: "Version of the firefox browser (e.g. 109, 108, latest)."
required: false
default: "109"
tag:
description: "Tag of the docker image to build (If not set, <release-date>-chrome[version]-firefox[version] will be used)"
required: false
default: ""
env:
GHCR_REGISTRY: ghcr.io
IMAGE_NAME: pyodide/pyodide-env
jobs:
build_docker:
runs-on: ubuntu-latest
environment: Docker
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log into Docker Hub registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
- name: Set tag
id: tag
run: |
TAG=${{ github.event.inputs.tag }}
if [ -z "$TAG" ]; then
DATE=$(date +'%Y%m%d')
TAG="$DATE-chrome${{ github.event.inputs.chrome_version }}-firefox${{ github.event.inputs.firefox_version }}"
fi
echo "::set-output name=tag::$TAG"
- name: Build and push Docker image to Docker Hub
id: build
uses: docker/build-push-action@v6
with:
file: ./Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CHROME_VERSION=${{ github.event.inputs.chrome_version }}
FIREFOX_VERSION=${{ github.event.inputs.firefox_version }}
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}
build_ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log into registry ${{ env.GHCR_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set tag
id: tag
run: |
TAG=${{ github.event.inputs.tag }}
if [ -z "$TAG" ]; then
DATE=$(date +'%Y%m%d')
TAG="$DATE-chrome${{ github.event.inputs.chrome_version }}-firefox${{ github.event.inputs.firefox_version }}"
fi
echo "::set-output name=tag::$TAG"
- name: Build and push Docker image to ${{ env.GHCR_REGISTRY }}
id: build
uses: docker/build-push-action@v6
with:
file: ./Dockerfile
push: true
tags: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CHROME_VERSION=${{ github.event.inputs.chrome_version }}
FIREFOX_VERSION=${{ github.event.inputs.firefox_version }}
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}