-
Notifications
You must be signed in to change notification settings - Fork 3
146 lines (131 loc) · 7.35 KB
/
docker.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Docker
on:
push:
branches:
- main
pull_request: {}
env:
REGISTRY: ghcr.io
jobs:
build-and-push-images:
name: Build Docker images and Push to GitHub Container-Registry
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set DIR_NAME and IMAGE_NAME (devcontainer-base)
run: |
DIR_NAME=devcontainer-base
echo "DIR_NAME=$DIR_NAME" >> $GITHUB_ENV
echo "IMAGE_NAME=gantsign/$DIR_NAME" >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker (devcontainer-base)
id: meta_base
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
labels: |
org.opencontainers.image.title=Development Container Base
org.opencontainers.image.description=Base container image for development
- name: Build and push Docker image (devcontainer-base)
uses: docker/build-push-action@v5
with:
context: ${{ env.DIR_NAME }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_base.outputs.tags }}
cache-from: type=registry,ref=${{ fromJSON(steps.meta_base.outputs.json).tags[1] }}
cache-to: type=inline
no-cache: ${{ github.event_name != 'pull_request' }}
# Omit licenses label as there's no pratical way to get an accurate value for all the Ubuntu packages
# org.opencontainers.image.licenses=
labels: |
org.opencontainers.image.title=${{ fromJSON(steps.meta_base.outputs.json).labels['org.opencontainers.image.title'] }}
org.opencontainers.image.description=${{ fromJSON(steps.meta_base.outputs.json).labels['org.opencontainers.image.description'] }}
org.opencontainers.image.url=${{ fromJSON(steps.meta_base.outputs.json).labels['org.opencontainers.image.url'] }}
org.opencontainers.image.source=${{ fromJSON(steps.meta_base.outputs.json).labels['org.opencontainers.image.source'] }}
org.opencontainers.image.version=${{ fromJSON(steps.meta_base.outputs.json).labels['org.opencontainers.image.version'] }}
org.opencontainers.image.created=${{ fromJSON(steps.meta_base.outputs.json).labels['org.opencontainers.image.created'] }}
org.opencontainers.image.revision=${{ fromJSON(steps.meta_base.outputs.json).labels['org.opencontainers.image.revision'] }}
- name: Set DIR_NAME and IMAGE_NAME (devcontainer-dind)
run: |
DIR_NAME=devcontainer-dind
echo "DIR_NAME=$DIR_NAME" >> $GITHUB_ENV
echo "IMAGE_NAME=gantsign/$DIR_NAME" >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker (devcontainer-dind)
id: meta_dind
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
labels: |
org.opencontainers.image.title=Development Container DinD
org.opencontainers.image.description=Container image for development with Docker-in-Docker
- name: Build and push Docker image (devcontainer-dind)
uses: docker/build-push-action@v5
with:
context: ${{ env.DIR_NAME }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_dind.outputs.tags }}
cache-from: type=registry,ref=${{ fromJSON(steps.meta_dind.outputs.json).tags[1] }}
cache-to: type=inline
no-cache: ${{ github.event_name != 'pull_request' }}
# Omit licenses label as there's no pratical way to get an accurate value for all the Ubuntu packages
# org.opencontainers.image.licenses=
labels: |
org.opencontainers.image.title=${{ fromJSON(steps.meta_dind.outputs.json).labels['org.opencontainers.image.title'] }}
org.opencontainers.image.description=${{ fromJSON(steps.meta_dind.outputs.json).labels['org.opencontainers.image.description'] }}
org.opencontainers.image.url=${{ fromJSON(steps.meta_dind.outputs.json).labels['org.opencontainers.image.url'] }}
org.opencontainers.image.source=${{ fromJSON(steps.meta_dind.outputs.json).labels['org.opencontainers.image.source'] }}
org.opencontainers.image.version=${{ fromJSON(steps.meta_dind.outputs.json).labels['org.opencontainers.image.version'] }}
org.opencontainers.image.created=${{ fromJSON(steps.meta_dind.outputs.json).labels['org.opencontainers.image.created'] }}
org.opencontainers.image.revision=${{ fromJSON(steps.meta_dind.outputs.json).labels['org.opencontainers.image.revision'] }}
- name: Set DIR_NAME and IMAGE_NAME (devcontainer-k8s)
run: |
DIR_NAME=devcontainer-k8s
echo "DIR_NAME=$DIR_NAME" >> $GITHUB_ENV
echo "IMAGE_NAME=gantsign/$DIR_NAME" >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker (devcontainer-k8s)
id: meta_k8s
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
labels: |
org.opencontainers.image.title=Development Container K8s
org.opencontainers.image.description=Container image for development with Kubernetes (K3s)
- name: Build and push Docker image (devcontainer-k8s)
uses: docker/build-push-action@v5
with:
context: ${{ env.DIR_NAME }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_k8s.outputs.tags }}
cache-from: type=registry,ref=${{ fromJSON(steps.meta_k8s.outputs.json).tags[1] }}
cache-to: type=inline
no-cache: ${{ github.event_name != 'pull_request' }}
# Omit licenses label as there's no pratical way to get an accurate value for all the Ubuntu packages
# org.opencontainers.image.licenses=
labels: |
org.opencontainers.image.title=${{ fromJSON(steps.meta_k8s.outputs.json).labels['org.opencontainers.image.title'] }}
org.opencontainers.image.description=${{ fromJSON(steps.meta_k8s.outputs.json).labels['org.opencontainers.image.description'] }}
org.opencontainers.image.url=${{ fromJSON(steps.meta_k8s.outputs.json).labels['org.opencontainers.image.url'] }}
org.opencontainers.image.source=${{ fromJSON(steps.meta_k8s.outputs.json).labels['org.opencontainers.image.source'] }}
org.opencontainers.image.version=${{ fromJSON(steps.meta_k8s.outputs.json).labels['org.opencontainers.image.version'] }}
org.opencontainers.image.created=${{ fromJSON(steps.meta_k8s.outputs.json).labels['org.opencontainers.image.created'] }}
org.opencontainers.image.revision=${{ fromJSON(steps.meta_k8s.outputs.json).labels['org.opencontainers.image.revision'] }}
- name: Build and push Docker image (devcontainer-python3.9)
uses: devcontainers/[email protected]
with:
subFolder: devcontainer-python3.9
imageName: ghcr.io/gantsign/devcontainer-python3.9