From 438fc345d41d7c7894b6392e4ee7c8aa4db45258 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 May 2024 20:00:03 -0600 Subject: [PATCH 1/6] chore: add canary docs as a develop branch --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 84c57c7f4..bbda3053c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,8 +49,12 @@ feat: add new feature ``` + + ## Setup +Before you start, please make the clone based on the `canary` branch, since the `main` branch is the source of truth and should always reflect the latest stable release, also the PRs will be merged to the `canary` branch. + ```bash git clone https://github.com/dokploy/dokploy.git cd dokploy From 367780cccbf20090bbfb8e23810c561ec91cb02a Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 May 2024 20:46:05 -0600 Subject: [PATCH 2/6] chore: add Docker build on PR --- .env.production.example | 3 ++ .github/workflows/pull-request.yml | 55 ++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .env.production.example diff --git a/.env.production.example b/.env.production.example new file mode 100644 index 000000000..41e934c3a --- /dev/null +++ b/.env.production.example @@ -0,0 +1,3 @@ +DATABASE_URL="postgres://dokploy:amukds4wi9001583845717ad2@dokploy-postgres:5432/dokploy" +PORT=3000 +NODE_ENV=production \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index e13b5b10e..42a8d7cd7 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -5,7 +5,8 @@ on: - main - canary jobs: - build: + build-app: + if: github.event_name == 'pull_request' runs-on: ubuntu-20.04 strategy: matrix: @@ -23,4 +24,54 @@ jobs: - name: Install dependencies run: pnpm install - name: Run Build - run: pnpm build \ No newline at end of file + run: pnpm build + + + build-docker-on-pr: + if: github.event_name == 'pull_request' + needs: build-app + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Prepare .env file + run: | + cp .env.production.example .env.production + + - name: Run custom Docker build script + run: | + + chmod +x ./docker/build.sh + echo "Building Docker image for ${{ github.head_ref }}" + ./docker/build.sh ${{ github.head_ref == 'canary' && 'canary' || '' }} + + build-and-push-docker-on-push: + if: github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Prepare .env file + run: | + cp .env.production.example .env.production + + - name: Build and push Docker image using custom script + run: | + chmod +x ./docker/build.sh + chmod +x ./docker/push.sh + ./docker/build.sh ${{ github.ref_name == 'canary' && 'canary' || '' }} + ./docker/push.sh ${{ github.ref_name == 'canary' && 'canary' || '' }} \ No newline at end of file From 13eea467a0512d0281a59c7621507ec987426941 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 May 2024 20:51:46 -0600 Subject: [PATCH 3/6] refactor: set base ref instead of head --- .github/workflows/pull-request.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 42a8d7cd7..6b8bc2903 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -46,8 +46,8 @@ jobs: run: | chmod +x ./docker/build.sh - echo "Building Docker image for ${{ github.head_ref }}" - ./docker/build.sh ${{ github.head_ref == 'canary' && 'canary' || '' }} + echo "Building Docker image for ${{ github.base_ref }}" + ./docker/build.sh ${{ github.base_ref == 'canary' && 'canary' || '' }} build-and-push-docker-on-push: if: github.event_name == 'push' @@ -73,5 +73,5 @@ jobs: run: | chmod +x ./docker/build.sh chmod +x ./docker/push.sh - ./docker/build.sh ${{ github.ref_name == 'canary' && 'canary' || '' }} - ./docker/push.sh ${{ github.ref_name == 'canary' && 'canary' || '' }} \ No newline at end of file + ./docker/build.sh ${{ github.base_ref == 'canary' && 'canary' || '' }} + ./docker/push.sh ${{ github.base_ref == 'canary' && 'canary' || '' }} \ No newline at end of file From 9ee6eb5d8805f9515b6404d6dfa11784e96c823d Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 May 2024 21:01:53 -0600 Subject: [PATCH 4/6] chore: add build to push --- .github/workflows/pull-request.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6b8bc2903..fab445cc4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,6 +4,11 @@ on: branches: - main - canary + + push: + branches: + - main + - canary jobs: build-app: if: github.event_name == 'pull_request' From ef4d763658df9e96282e93ec03e48c9e89c742ff Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 May 2024 21:05:52 -0600 Subject: [PATCH 5/6] chore: test the env --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fab445cc4..d723239a9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -49,7 +49,7 @@ jobs: - name: Run custom Docker build script run: | - + cat .env.production chmod +x ./docker/build.sh echo "Building Docker image for ${{ github.base_ref }}" ./docker/build.sh ${{ github.base_ref == 'canary' && 'canary' || '' }} From f4c2dc99d92b23ae4cdfc977bc127a392ed9d2e4 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Wed, 1 May 2024 21:08:47 -0600 Subject: [PATCH 6/6] chore: remove cat file --- .github/workflows/pull-request.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index d723239a9..3d14d6c21 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -49,7 +49,6 @@ jobs: - name: Run custom Docker build script run: | - cat .env.production chmod +x ./docker/build.sh echo "Building Docker image for ${{ github.base_ref }}" ./docker/build.sh ${{ github.base_ref == 'canary' && 'canary' || '' }}