Skip to content

Commit 7a26dc6

Browse files
committed
fix: enhance docker image build github action
1 parent 722480d commit 7a26dc6

File tree

1 file changed

+100
-7
lines changed

1 file changed

+100
-7
lines changed

.github/workflows/docker-images.yml

Lines changed: 100 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,135 @@
1-
name: Build lowcoder dev image
1+
name: Build lowcoder docker images
22

33
on:
4+
workflow_dispatch:
5+
inputs:
6+
imageTag:
7+
type: choice
8+
description: 'Choose a tag for built docker image(s)'
9+
required: true
10+
default: 'latest'
11+
options:
12+
- latest
13+
- test
14+
build_allinone:
15+
type: boolean
16+
description: 'Build the All-In-One image'
17+
default: true
18+
build_frontend:
19+
type: boolean
20+
description: 'Build the Frontend image'
21+
default: true
22+
build_nodeservice:
23+
type: boolean
24+
description: 'Build the Node service image'
25+
default: true
26+
build_apiservice:
27+
type: boolean
28+
description: 'Build the API service image'
29+
default: true
430
push:
531
branches: dev
32+
paths:
33+
- 'client/**'
34+
- 'server/**'
35+
- 'deploy/docker/**'
36+
release:
37+
types: [released]
638

739
jobs:
840
build:
941
runs-on: ubuntu-latest
1042
steps:
11-
- name: Checkout lowcoder from 'dev' branch
43+
- name: Set environment variables
44+
shell: bash
45+
run: |
46+
# Get the short SHA of last commit
47+
echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> "${GITHUB_ENV}"
48+
49+
# Get branch name - we don't use github.ref_head_name since we don't build on PRs
50+
echo "BRANCH_NAME=${{ github.ref_name }}" >> "${GITHUB_ENV}"
51+
52+
# Set docker image tag
53+
echo "IMAGE_TAG=${{ inputs.imageTag || github.ref_name }}" >> "${GITHUB_ENV}"
54+
55+
# Control which images to build
56+
echo "BUILD_ALLINONE=${{ inputs.build_allinone || true }}" >> "${GITHUB_ENV}"
57+
echo "BUILD_FRONTEND=${{ inputs.build_frontend || true }}" >> "${GITHUB_ENV}"
58+
echo "BUILD_NODESERVICE=${{ inputs.build_nodeservice || true }}" >> "${GITHUB_ENV}"
59+
echo "BUILD_APISERVICE=${{ inputs.build_apiservice || true }}" >> "${GITHUB_ENV}"
60+
61+
- name: Checkout lowcoder source
1262
uses: actions/checkout@v4
1363
with:
14-
ref: dev
15-
- name: Get commit short SHA
16-
run: echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
64+
ref: ${{ env.BRANCH_NAME }}
65+
1766
- name: Log into Docker Hub
1867
uses: docker/login-action@v3
1968
with:
2069
username: ${{ secrets.DOCKER_LOGIN }}
2170
password: ${{ secrets.DOCKER_PASSWORD }}
71+
2272
- name: Setup Docker Buildx with cloud driver
2373
uses: docker/setup-buildx-action@v3
2474
with:
2575
version: "lab:latest"
2676
driver: cloud
2777
endpoint: "lowcoderorg/lowcoder-cloud-builder"
78+
2879
- name: Build and push the all-in-one image
80+
if: ${{ env.BUILD_ALLINONE == 'true' }}
81+
uses: docker/build-push-action@v6
82+
env:
83+
NODE_ENV: production
84+
with:
85+
file: ./deploy/docker/Dockerfile
86+
build-args: |
87+
REACT_APP_ENV=production
88+
REACT_APP_COMMIT_ID="dev #${{ env.SHORT_SHA }}"
89+
platforms: |
90+
linux/amd64
91+
linux/arm64
92+
push: true
93+
tags: lowcoderorg/lowcoder-ce:${{ env.IMAGE_TAG }}
94+
95+
- name: Build and push the frontend image
96+
if: ${{ env.BUILD_FRONTEND == 'true' }}
2997
uses: docker/build-push-action@v6
3098
env:
3199
NODE_ENV: production
32100
with:
33101
file: ./deploy/docker/Dockerfile
102+
target: lowcoder-ce-frontend
34103
build-args: |
35104
REACT_APP_ENV=production
36-
REACT_APP_COMMIT_ID="dev #${SHORT_SHA}"
105+
REACT_APP_COMMIT_ID="dev #${{ env.SHORT_SHA }}"
106+
platforms: |
107+
linux/amd64
108+
linux/arm64
109+
push: true
110+
tags: lowcoderorg/lowcoder-ce-frontend:${{ env.IMAGE_TAG }}
111+
112+
- name: Build and push the node service image
113+
if: ${{ env.BUILD_NODESERVICE == 'true' }}
114+
uses: docker/build-push-action@v6
115+
with:
116+
file: ./deploy/docker/Dockerfile
117+
target: lowcoder-ce-node-service
118+
platforms: |
119+
linux/amd64
120+
linux/arm64
121+
push: true
122+
tags: lowcoderorg/lowcoder-ce-node-service:${{ env.IMAGE_TAG }}
123+
124+
- name: Build and push the API service image
125+
if: ${{ env.BUILD_APISERVICE == 'true' }}
126+
uses: docker/build-push-action@v6
127+
with:
128+
file: ./deploy/docker/Dockerfile
129+
target: lowcoder-ce-api-service
37130
platforms: |
38131
linux/amd64
39132
linux/arm64
40133
push: true
41-
tags: lowcoderorg/lowcoder-ce:dev
134+
tags: lowcoderorg/lowcoder-ce-api-service:${{ env.IMAGE_TAG }}
42135

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy