Skip to content

Commit e516b41

Browse files
authored
fix(web): password input type + ci reusable workflow + multi-arch images (#808)
1 parent ec19e5d commit e516b41

8 files changed

Lines changed: 133 additions & 386 deletions

File tree

.github/workflows/apps-api.yaml

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -20,62 +20,8 @@ on:
2020

2121
jobs:
2222
build:
23-
runs-on: ubuntu-latest
24-
25-
permissions:
26-
contents: read
27-
id-token: write
28-
29-
strategy:
30-
matrix:
31-
platform: [linux/amd64]
32-
33-
steps:
34-
- uses: actions/checkout@v4
35-
36-
- name: Set up QEMU
37-
uses: docker/setup-qemu-action@v3
38-
39-
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v3
41-
42-
- name: Check if Docker Hub secrets are available
43-
run: |
44-
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
45-
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
46-
else
47-
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
48-
fi
49-
50-
- name: Login to Docker Hub
51-
uses: docker/login-action@v3
52-
if: env.DOCKERHUB_LOGIN == 'true'
53-
with:
54-
username: ${{ secrets.DOCKERHUB_USERNAME }}
55-
password: ${{ secrets.DOCKERHUB_TOKEN }}
56-
57-
- name: Extract metadata (tags, labels) for Docker
58-
id: meta
59-
uses: docker/metadata-action@v4
60-
with:
61-
images: ctrlplane/api
62-
tags: |
63-
type=sha,format=short,prefix=
64-
65-
- name: Build
66-
uses: docker/build-push-action@v6
67-
if: github.ref != 'refs/heads/main'
68-
with:
69-
push: false
70-
file: apps/api/Dockerfile
71-
platforms: ${{ matrix.platform }}
72-
tags: ${{ steps.meta.outputs.tags }}
73-
74-
- name: Build and Push
75-
uses: docker/build-push-action@v6
76-
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
77-
with:
78-
push: true
79-
file: apps/api/Dockerfile
80-
platforms: ${{ matrix.platform }}
81-
tags: ${{ steps.meta.outputs.tags }}
23+
uses: ./.github/workflows/build-image.yaml
24+
secrets: inherit
25+
with:
26+
image-name: ctrlplane/api
27+
dockerfile: apps/api/Dockerfile

.github/workflows/apps-relay.yaml

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -48,68 +48,9 @@ jobs:
4848
run: go test -race ./...
4949

5050
build:
51-
runs-on: ubuntu-latest
52-
53-
permissions:
54-
contents: read
55-
id-token: write
56-
57-
strategy:
58-
matrix:
59-
platform: [linux/amd64]
60-
61-
defaults:
62-
run:
63-
working-directory: apps/relay
64-
65-
steps:
66-
- uses: actions/checkout@v4
67-
68-
- name: Set up QEMU
69-
uses: docker/setup-qemu-action@v3
70-
71-
- name: Set up Docker Buildx
72-
uses: docker/setup-buildx-action@v3
73-
74-
- name: Check if Docker Hub secrets are available
75-
run: |
76-
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
77-
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
78-
else
79-
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
80-
fi
81-
82-
- name: Login to Docker Hub
83-
uses: docker/login-action@v3
84-
if: env.DOCKERHUB_LOGIN == 'true'
85-
with:
86-
username: ${{ secrets.DOCKERHUB_USERNAME }}
87-
password: ${{ secrets.DOCKERHUB_TOKEN }}
88-
89-
- name: Extract metadata (tags, labels) for Docker
90-
id: meta
91-
uses: docker/metadata-action@v4
92-
with:
93-
images: ctrlplane/relay
94-
tags: |
95-
type=sha,format=short,prefix=
96-
97-
- name: Build
98-
uses: docker/build-push-action@v6
99-
if: github.ref != 'refs/heads/main'
100-
with:
101-
context: apps/relay
102-
push: false
103-
file: apps/relay/Dockerfile
104-
platforms: ${{ matrix.platform }}
105-
tags: ${{ steps.meta.outputs.tags }}
106-
107-
- name: Build and Push
108-
uses: docker/build-push-action@v6
109-
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
110-
with:
111-
context: apps/relay
112-
push: true
113-
file: apps/relay/Dockerfile
114-
platforms: ${{ matrix.platform }}
115-
tags: ${{ steps.meta.outputs.tags }}
51+
uses: ./.github/workflows/build-image.yaml
52+
secrets: inherit
53+
with:
54+
image-name: ctrlplane/relay
55+
dockerfile: apps/relay/Dockerfile
56+
context: apps/relay

.github/workflows/apps-web.yaml

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -14,77 +14,10 @@ on:
1414
- "packages/**"
1515
workflow_dispatch:
1616

17-
env:
18-
REGISTRY: ghcr.io
19-
IMAGE_NAME: ${{ github.repository }}/web
20-
2117
jobs:
22-
build-and-push:
23-
runs-on: ubuntu-latest
24-
25-
permissions:
26-
contents: read
27-
packages: write
28-
29-
strategy:
30-
matrix:
31-
platform: [linux/amd64]
32-
33-
steps:
34-
- uses: actions/checkout@v4
35-
36-
- name: Set up QEMU
37-
uses: docker/setup-qemu-action@v3
38-
39-
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v3
41-
42-
- name: Check if Docker Hub secrets are available
43-
run: |
44-
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
45-
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
46-
else
47-
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
48-
fi
49-
50-
- name: Log in to Container Registry
51-
uses: docker/login-action@v3
52-
if: env.DOCKERHUB_LOGIN == 'true'
53-
with:
54-
username: ${{ secrets.DOCKERHUB_USERNAME }}
55-
password: ${{ secrets.DOCKERHUB_TOKEN }}
56-
57-
- name: Extract metadata (tags, labels) for Docker
58-
id: meta
59-
uses: docker/metadata-action@v4
60-
with:
61-
images: ctrlplane/web
62-
tags: |
63-
type=sha,format=short,prefix=
64-
65-
- name: Build
66-
uses: docker/build-push-action@v6
67-
if: github.ref != 'refs/heads/main'
68-
with:
69-
push: false
70-
file: apps/web/Dockerfile
71-
platforms: ${{ matrix.platform }}
72-
tags: ${{ steps.meta.outputs.tags }}
73-
74-
- name: Build and Push
75-
uses: docker/build-push-action@v6
76-
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
77-
with:
78-
push: true
79-
file: apps/web/Dockerfile
80-
platforms: ${{ matrix.platform }}
81-
tags: ${{ steps.meta.outputs.tags }}
82-
83-
- name: Summary
84-
run: |
85-
echo "### Docker Image Built Successfully! 🚀" >> $GITHUB_STEP_SUMMARY
86-
echo "" >> $GITHUB_STEP_SUMMARY
87-
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
88-
echo '```' >> $GITHUB_STEP_SUMMARY
89-
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
90-
echo '```' >> $GITHUB_STEP_SUMMARY
18+
build:
19+
uses: ./.github/workflows/build-image.yaml
20+
secrets: inherit
21+
with:
22+
image-name: ctrlplane/web
23+
dockerfile: apps/web/Dockerfile

.github/workflows/apps-workspace-engine-router.yaml

Lines changed: 6 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,73 +14,9 @@ on:
1414

1515
jobs:
1616
build:
17-
runs-on: ubuntu-latest
18-
19-
permissions:
20-
contents: read
21-
id-token: write
22-
23-
strategy:
24-
matrix:
25-
platform: [linux/amd64]
26-
27-
defaults:
28-
run:
29-
working-directory: apps/workspace-engine-router
30-
31-
steps:
32-
- uses: actions/checkout@v4
33-
34-
- name: Set up Go
35-
uses: actions/setup-go@v4
36-
with:
37-
go-version: "1.25"
38-
39-
- name: Set up QEMU
40-
uses: docker/setup-qemu-action@v3
41-
42-
- name: Set up Docker Buildx
43-
uses: docker/setup-buildx-action@v3
44-
45-
- name: Check if Docker Hub secrets are available
46-
run: |
47-
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
48-
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
49-
else
50-
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
51-
fi
52-
53-
- name: Login to Docker Hub
54-
uses: docker/login-action@v3
55-
if: env.DOCKERHUB_LOGIN == 'true'
56-
with:
57-
username: ${{ secrets.DOCKERHUB_USERNAME }}
58-
password: ${{ secrets.DOCKERHUB_TOKEN }}
59-
60-
- name: Extract metadata (tags, labels) for Docker
61-
id: meta
62-
uses: docker/metadata-action@v4
63-
with:
64-
images: ctrlplane/workspace-engine-router
65-
tags: |
66-
type=sha,format=short,prefix=
67-
68-
- name: Build
69-
uses: docker/build-push-action@v6
70-
if: github.ref != 'refs/heads/main'
71-
with:
72-
context: apps/workspace-engine-router
73-
push: false
74-
file: apps/workspace-engine-router/Dockerfile
75-
platforms: ${{ matrix.platform }}
76-
tags: ${{ steps.meta.outputs.tags }}
77-
78-
- name: Build and Push
79-
uses: docker/build-push-action@v6
80-
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
81-
with:
82-
context: apps/workspace-engine-router
83-
push: true
84-
file: apps/workspace-engine-router/Dockerfile
85-
platforms: ${{ matrix.platform }}
86-
tags: ${{ steps.meta.outputs.tags }}
17+
uses: ./.github/workflows/build-image.yaml
18+
secrets: inherit
19+
with:
20+
image-name: ctrlplane/workspace-engine-router
21+
dockerfile: apps/workspace-engine-router/Dockerfile
22+
context: apps/workspace-engine-router

.github/workflows/apps-workspace-engine.yaml

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -131,68 +131,9 @@ jobs:
131131
run: go test -race ./...
132132

133133
build:
134-
runs-on: ubuntu-latest
135-
136-
permissions:
137-
contents: read
138-
id-token: write
139-
140-
strategy:
141-
matrix:
142-
platform: [linux/amd64]
143-
144-
defaults:
145-
run:
146-
working-directory: apps/workspace-engine
147-
148-
steps:
149-
- uses: actions/checkout@v4
150-
151-
- name: Set up QEMU
152-
uses: docker/setup-qemu-action@v3
153-
154-
- name: Set up Docker Buildx
155-
uses: docker/setup-buildx-action@v3
156-
157-
- name: Check if Docker Hub secrets are available
158-
run: |
159-
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
160-
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
161-
else
162-
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
163-
fi
164-
165-
- name: Login to Docker Hub
166-
uses: docker/login-action@v3
167-
if: env.DOCKERHUB_LOGIN == 'true'
168-
with:
169-
username: ${{ secrets.DOCKERHUB_USERNAME }}
170-
password: ${{ secrets.DOCKERHUB_TOKEN }}
171-
172-
- name: Extract metadata (tags, labels) for Docker
173-
id: meta
174-
uses: docker/metadata-action@v4
175-
with:
176-
images: ctrlplane/workspace-engine
177-
tags: |
178-
type=sha,format=short,prefix=
179-
180-
- name: Build
181-
uses: docker/build-push-action@v6
182-
if: github.ref != 'refs/heads/main'
183-
with:
184-
context: apps/workspace-engine
185-
push: false
186-
file: apps/workspace-engine/Dockerfile
187-
platforms: ${{ matrix.platform }}
188-
tags: ${{ steps.meta.outputs.tags }}
189-
190-
- name: Build and Push
191-
uses: docker/build-push-action@v6
192-
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
193-
with:
194-
context: apps/workspace-engine
195-
push: true
196-
file: apps/workspace-engine/Dockerfile
197-
platforms: ${{ matrix.platform }}
198-
tags: ${{ steps.meta.outputs.tags }}
134+
uses: ./.github/workflows/build-image.yaml
135+
secrets: inherit
136+
with:
137+
image-name: ctrlplane/workspace-engine
138+
dockerfile: apps/workspace-engine/Dockerfile
139+
context: apps/workspace-engine

0 commit comments

Comments
 (0)