|
1 |
| -name: Build lowcoder dev image |
| 1 | +name: Build lowcoder docker images |
2 | 2 |
|
3 | 3 | 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 |
4 | 30 | push:
|
5 | 31 | branches: dev
|
| 32 | +# paths: |
| 33 | +# - 'client/**' |
| 34 | +# - 'server/**' |
| 35 | +# - 'deploy/docker/**' |
| 36 | + release: |
| 37 | + types: [released] |
6 | 38 |
|
7 | 39 | jobs:
|
8 | 40 | build:
|
9 | 41 | runs-on: ubuntu-latest
|
10 | 42 | 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 |
12 | 62 | uses: actions/checkout@v4
|
13 | 63 | 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 | + |
17 | 66 | - name: Log into Docker Hub
|
18 | 67 | uses: docker/login-action@v3
|
19 | 68 | with:
|
20 | 69 | username: ${{ secrets.DOCKER_LOGIN }}
|
21 | 70 | password: ${{ secrets.DOCKER_PASSWORD }}
|
| 71 | + |
22 | 72 | - name: Setup Docker Buildx with cloud driver
|
23 | 73 | uses: docker/setup-buildx-action@v3
|
24 | 74 | with:
|
25 | 75 | version: "lab:latest"
|
26 | 76 | driver: cloud
|
27 | 77 | endpoint: "lowcoderorg/lowcoder-cloud-builder"
|
| 78 | + |
28 | 79 | - 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' }} |
29 | 97 | uses: docker/build-push-action@v6
|
30 | 98 | env:
|
31 | 99 | NODE_ENV: production
|
32 | 100 | with:
|
33 | 101 | file: ./deploy/docker/Dockerfile
|
| 102 | + target: lowcoder-ce-frontend |
34 | 103 | build-args: |
|
35 | 104 | 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 |
37 | 130 | platforms: |
|
38 | 131 | linux/amd64
|
39 | 132 | linux/arm64
|
40 | 133 | push: true
|
41 |
| - tags: lowcoderorg/lowcoder-ce:dev |
| 134 | + tags: lowcoderorg/lowcoder-ce-api-service:${{ env.IMAGE_TAG }} |
42 | 135 |
|
0 commit comments