|
| 1 | +name: Dokploy Docker Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, canary, feat/github-runners] |
| 6 | + |
| 7 | +env: |
| 8 | + IMAGE_NAME: dokploy/dokploy |
| 9 | + |
| 10 | +jobs: |
| 11 | + docker-amd: |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Set up Docker Buildx |
| 18 | + uses: docker/setup-buildx-action@v3 |
| 19 | + |
| 20 | + - name: Login to Docker Hub |
| 21 | + uses: docker/login-action@v3 |
| 22 | + with: |
| 23 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 24 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 25 | + |
| 26 | + - name: Set tag and version |
| 27 | + id: meta |
| 28 | + run: | |
| 29 | + if [ "${{ github.ref }}" = "refs/heads/main" ]; then |
| 30 | + TAG="latest" |
| 31 | + VERSION=$(node -p "require('./apps/dokploy/package.json').version") |
| 32 | + elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then |
| 33 | + TAG="canary" |
| 34 | + else |
| 35 | + TAG="feature" |
| 36 | + fi |
| 37 | + echo "tags=${IMAGE_NAME}:${TAG}-amd64" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + - name: Prepare env file |
| 40 | + run: | |
| 41 | + cp apps/dokploy/.env.production.example .env.production |
| 42 | + cp apps/dokploy/.env.production.example apps/dokploy/.env.production |
| 43 | +
|
| 44 | + - name: Build and push |
| 45 | + uses: docker/build-push-action@v5 |
| 46 | + with: |
| 47 | + context: . |
| 48 | + platforms: linux/amd64 |
| 49 | + push: true |
| 50 | + tags: ${{ steps.meta.outputs.tags }} |
| 51 | + docker-arm: |
| 52 | + runs-on: ubuntu-24.04-arm |
| 53 | + steps: |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Set up Docker Buildx |
| 58 | + uses: docker/setup-buildx-action@v3 |
| 59 | + |
| 60 | + - name: Login to Docker Hub |
| 61 | + uses: docker/login-action@v3 |
| 62 | + with: |
| 63 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 64 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 65 | + |
| 66 | + - name: Set tag and version |
| 67 | + id: meta |
| 68 | + run: | |
| 69 | + VERSION=$(node -p "require('./apps/dokploy/package.json').version") |
| 70 | + if [ "${{ github.ref }}" = "refs/heads/main" ]; then |
| 71 | + TAG="latest" |
| 72 | + VERSION=$(node -p "require('./apps/dokploy/package.json').version") |
| 73 | + elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then |
| 74 | + TAG="canary" |
| 75 | + else |
| 76 | + TAG="feature" |
| 77 | + fi |
| 78 | + echo "tags=${IMAGE_NAME}:${TAG}-arm64" >> $GITHUB_OUTPUT |
| 79 | +
|
| 80 | + - name: Prepare env file |
| 81 | + run: | |
| 82 | + cp apps/dokploy/.env.production.example .env.production |
| 83 | + cp apps/dokploy/.env.production.example apps/dokploy/.env.production |
| 84 | +
|
| 85 | + - name: Build and push |
| 86 | + uses: docker/build-push-action@v5 |
| 87 | + with: |
| 88 | + context: . |
| 89 | + platforms: linux/arm64 |
| 90 | + push: true |
| 91 | + tags: ${{ steps.meta.outputs.tags }} |
| 92 | + |
| 93 | + combine-manifests: |
| 94 | + needs: [docker-amd, docker-arm] |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - name: Checkout |
| 98 | + uses: actions/checkout@v4 |
| 99 | + |
| 100 | + - name: Set up Docker Buildx |
| 101 | + uses: docker/setup-buildx-action@v3 |
| 102 | + |
| 103 | + - name: Login to Docker Hub |
| 104 | + uses: docker/login-action@v3 |
| 105 | + with: |
| 106 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 107 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 108 | + |
| 109 | + - name: Create and push manifests |
| 110 | + run: | |
| 111 | + if [ "${{ github.ref }}" = "refs/heads/main" ]; then |
| 112 | + VERSION=$(node -p "require('./apps/dokploy/package.json').version") |
| 113 | + TAG="latest" |
| 114 | +
|
| 115 | + docker buildx imagetools create -t ${IMAGE_NAME}:${TAG} \ |
| 116 | + ${IMAGE_NAME}:${TAG}-amd64 \ |
| 117 | + ${IMAGE_NAME}:${TAG}-arm64 |
| 118 | +
|
| 119 | + docker buildx imagetools create -t ${IMAGE_NAME}:${VERSION} \ |
| 120 | + ${IMAGE_NAME}:${TAG}-amd64 \ |
| 121 | + ${IMAGE_NAME}:${TAG}-arm64 |
| 122 | +
|
| 123 | + elif [ "${{ github.ref }}" = "refs/heads/canary" ]; then |
| 124 | + TAG="canary" |
| 125 | + docker buildx imagetools create -t ${IMAGE_NAME}:${TAG} \ |
| 126 | + ${IMAGE_NAME}:${TAG}-amd64 \ |
| 127 | + ${IMAGE_NAME}:${TAG}-arm64 |
| 128 | +
|
| 129 | + else |
| 130 | + TAG="feature" |
| 131 | + docker buildx imagetools create -t ${IMAGE_NAME}:${TAG} \ |
| 132 | + ${IMAGE_NAME}:${TAG}-amd64 \ |
| 133 | + ${IMAGE_NAME}:${TAG}-arm64 |
| 134 | + fi |
| 135 | +
|
| 136 | + generate-release: |
| 137 | + needs: [combine-manifests] |
| 138 | + if: github.ref == 'refs/heads/main' |
| 139 | + runs-on: ubuntu-latest |
| 140 | + steps: |
| 141 | + - name: Checkout |
| 142 | + uses: actions/checkout@v4 |
| 143 | + with: |
| 144 | + fetch-depth: 0 |
| 145 | + |
| 146 | + - name: Get version |
| 147 | + id: get_version |
| 148 | + run: | |
| 149 | + VERSION=$(node -p "require('./apps/dokploy/package.json').version") |
| 150 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 151 | +
|
| 152 | + - name: Create Release |
| 153 | + uses: softprops/action-gh-release@v2 |
| 154 | + with: |
| 155 | + tag_name: v${{ steps.get_version.outputs.version }} |
| 156 | + name: Release v${{ steps.get_version.outputs.version }} |
| 157 | + generate_release_notes: true |
| 158 | + draft: false |
| 159 | + prerelease: false |
| 160 | + env: |
| 161 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments