Skip to content

Commit c334d46

Browse files
authored
Publish Docker images through CI (Gallopsled#2236)
Rebuild the images on push to the respective branch.
1 parent 3e4e8b7 commit c334d46

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/docker.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish Docker images
2+
on:
3+
push:
4+
branches:
5+
- dev
6+
- beta
7+
- stable
8+
workflow_dispatch:
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Docker meta
14+
id: meta
15+
uses: docker/metadata-action@v4
16+
with:
17+
images: |
18+
pwntools/pwntools
19+
tags: |
20+
type=ref,event=branch
21+
22+
# Required for subdirectories in Git context
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v2
25+
26+
- name: Login to Docker Hub
27+
uses: docker/login-action@v2
28+
with:
29+
username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
31+
32+
- name: Build and push base image
33+
uses: docker/build-push-action@v4
34+
if: github.event_name == 'workflow_dispatch'
35+
with:
36+
context: "{{defaultContext}}:extra/docker/base"
37+
push: true
38+
tags: pwntools/pwntools:base
39+
40+
- name: Build and push stable image
41+
uses: docker/build-push-action@v4
42+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/stable')
43+
with:
44+
context: "{{defaultContext}}:extra/docker/stable"
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
49+
- name: Build and push beta image
50+
uses: docker/build-push-action@v4
51+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/beta')
52+
with:
53+
context: "{{defaultContext}}:extra/docker/beta"
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
58+
- name: Build and push dev image
59+
uses: docker/build-push-action@v4
60+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/dev')
61+
with:
62+
context: "{{defaultContext}}:extra/docker/dev"
63+
push: true
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}
66+
67+
- name: Build and push ci image
68+
uses: docker/build-push-action@v4
69+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/dev')
70+
with:
71+
context: "{{defaultContext}}:travis/docker"
72+
push: true
73+
tags: pwntools/pwntools:ci
74+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)