-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (60 loc) · 1.78 KB
/
Copy pathcontainers.yml
File metadata and controls
67 lines (60 loc) · 1.78 KB
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
name: Containers build and push
on:
workflow_call:
inputs:
working-directory:
required: true
type: string
context-path:
required: true
type: string
compose-path:
required: true
type: string
registry:
required: true
type: string
container_type:
required: true
type: string
version:
required: true
type: string
runner:
required: true
type: string
secrets:
GHCR_USERNAME:
required: true
GHCR_TOKEN:
required: true
env:
REGISTRY: ${{ inputs.registry }}
TYPE: ${{ inputs.container_type }}
jobs:
containers_build_and_push:
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
run: |
git clone https://github.com/INGInious/util-compose.git
pip3 install -r util-compose/requirements.txt
- name: Generate compose file
working-directory: ${{ inputs.working-directory }}/util-compose
run: python3 generate.py ../${{ inputs.context-path}} ../${{ inputs.compose-path }} ${{ inputs.version }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push containers
working-directory: ${{ inputs.working-directory }}
run: |
# see https://github.com/docker/buildx/issues/344#issuecomment-846626613
docker buildx create --use
echo "FROM scratch" | docker buildx build -
docker compose build --push
docker compose push