Skip to content

Commit e82db47

Browse files
committed
refactor: add github docker
1 parent f9b4f00 commit e82db47

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Docker Build
2+
3+
on:
4+
pull_request:
5+
branches: [main, canary, feat/github-runners]
6+
env:
7+
IMAGE_NAME: dokploy/dokploy
8+
9+
jobs:
10+
docker-amd:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Login to Docker Hub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Set tag and version
26+
id: meta
27+
run: |
28+
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
29+
VERSION=$(node -p "require('./apps/dokploy/package.json').version")
30+
echo "tags=${IMAGE_NAME}:latest,${IMAGE_NAME}:${VERSION}" >> $GITHUB_OUTPUT
31+
elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then
32+
echo "tags=${IMAGE_NAME}:canary" >> $GITHUB_OUTPUT
33+
else
34+
echo "tags=${IMAGE_NAME}:feature" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Prepare env file
38+
run: |
39+
cp apps/dokploy/.env.production.example .env.production
40+
cp apps/dokploy/.env.production.example apps/dokploy/.env.production
41+
42+
- name: Build and push
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
platforms: linux/amd64
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
docker-arm:
50+
runs-on: ubuntu-24.04-arm
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Set up Docker Buildx
56+
uses: docker/setup-buildx-action@v3
57+
58+
- name: Login to Docker Hub
59+
uses: docker/login-action@v3
60+
with:
61+
username: ${{ secrets.DOCKERHUB_USERNAME }}
62+
password: ${{ secrets.DOCKERHUB_TOKEN }}
63+
64+
- name: Set tag and version
65+
id: meta
66+
run: |
67+
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
68+
VERSION=$(node -p "require('./apps/dokploy/package.json').version")
69+
echo "tags=${IMAGE_NAME}:latest,${IMAGE_NAME}:${VERSION}" >> $GITHUB_OUTPUT
70+
elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then
71+
echo "tags=${IMAGE_NAME}:canary" >> $GITHUB_OUTPUT
72+
else
73+
echo "tags=${IMAGE_NAME}:feature" >> $GITHUB_OUTPUT
74+
fi
75+
76+
- name: Prepare env file
77+
run: |
78+
cp apps/dokploy/.env.production.example .env.production
79+
cp apps/dokploy/.env.production.example apps/dokploy/.env.production
80+
81+
- name: Build and push
82+
uses: docker/build-push-action@v5
83+
with:
84+
context: .
85+
platforms: linux/arm64
86+
push: true
87+
tags: ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)