Skip to content

Commit fe37284

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

File tree

1 file changed

+63
-19
lines changed

1 file changed

+63
-19
lines changed

.github/workflows/docker-images.yml

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,62 @@
1-
name: Build lowcoder dev image
1+
name: 'Build lowcoder docker images'
22

33
on:
4+
workflow_dispatch:
5+
inputs:
6+
image_tag:
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+
run: |
45+
# Get the short SHA of last commit
46+
echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> "${GITHUB_ENV}"
47+
# Get branch name - we don't use github.ref_head_name since we don't build on PRs
48+
echo "BRANCH_NAME=${{ github.ref_name }}" >> "${GITHUB_ENV}"
49+
# Set docker image tag
50+
echo "IMAGE_TAG=${{ inputs.image_tag || github.ref_name }}" >> "${GITHUB_ENV}"
51+
# Control which images to build
52+
echo "BUILD_ALLINONE=${{ inputs.build_allinone || true }}" >> "${GITHUB_ENV}"
53+
echo "BUILD_FRONTEND=${{ inputs.build_frontend || true }}" >> "${GITHUB_ENV}"
54+
echo "BUILD_NODESERVICE=${{ inputs.build_nodeservice || true }}" >> "${GITHUB_ENV}"
55+
echo "BUILD_APISERVICE=${{ inputs.build_apiservice || true }}" >> "${GITHUB_ENV}"
56+
- name: Checkout lowcoder source
1257
uses: actions/checkout@v4
1358
with:
14-
ref: dev
15-
- name: Get commit short SHA
16-
run: echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
59+
ref: ${{ env.BRANCH_NAME }}
1760
- name: Log into Docker Hub
1861
uses: docker/login-action@v3
1962
with:
@@ -25,18 +68,19 @@ jobs:
2568
version: "lab:latest"
2669
driver: cloud
2770
endpoint: "lowcoderorg/lowcoder-cloud-builder"
28-
- name: Build and push the all-in-one image
29-
uses: docker/build-push-action@v6
30-
env:
31-
NODE_ENV: production
32-
with:
33-
file: ./deploy/docker/Dockerfile
34-
build-args: |
35-
REACT_APP_ENV=production
36-
REACT_APP_COMMIT_ID="dev #${SHORT_SHA}"
37-
platforms: |
38-
linux/amd64
39-
linux/arm64
40-
push: true
41-
tags: lowcoderorg/lowcoder-ce:dev
71+
# - name: Build and push the all-in-one image
72+
# if: ${{ env.BUILD_ALLINONE == 'true' }}
73+
# uses: docker/build-push-action@v6
74+
# env:
75+
# NODE_ENV: production
76+
# with:
77+
# file: ./deploy/docker/Dockerfile
78+
# build-args: |
79+
# REACT_APP_ENV=production
80+
# REACT_APP_COMMIT_ID="dev #${{ env.SHORT_SHA }}"
81+
# platforms: |
82+
# linux/amd64
83+
# linux/arm64
84+
# push: false
85+
# tags: lowcoderorg/lowcoder-ce:${{ env.IMAGE_TAG }}
4286

0 commit comments

Comments
 (0)