From 478c3545dba50800bd16e3e9b4883ebeb7ebb51b Mon Sep 17 00:00:00 2001 From: Dhrumil Mistry <56185972+dmdhrumilmistry@users.noreply.github.com> Date: Sat, 28 Oct 2023 18:56:11 +0530 Subject: [PATCH] separate docker files for main and dev update dev-push workflow --- .github/workflows/dev-push.yml | 41 ++++++++++--------- src/DockerFiles/dev/backend-api-Dockerfile | 5 +++ .../dev/backend-api-worker-Dockerfile | 5 +++ src/DockerFiles/dev/cli-Dockerfile | 3 ++ .../{ => main}/backend-api-Dockerfile | 0 .../{ => main}/backend-api-worker-Dockerfile | 0 src/DockerFiles/{ => main}/cli-Dockerfile | 0 7 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 src/DockerFiles/dev/backend-api-Dockerfile create mode 100644 src/DockerFiles/dev/backend-api-worker-Dockerfile create mode 100644 src/DockerFiles/dev/cli-Dockerfile rename src/DockerFiles/{ => main}/backend-api-Dockerfile (100%) rename src/DockerFiles/{ => main}/backend-api-worker-Dockerfile (100%) rename src/DockerFiles/{ => main}/cli-Dockerfile (100%) diff --git a/.github/workflows/dev-push.yml b/.github/workflows/dev-push.yml index fb4bdb3..6a2d4e7 100644 --- a/.github/workflows/dev-push.yml +++ b/.github/workflows/dev-push.yml @@ -6,7 +6,7 @@ on: - "dev" jobs: - push-base-docker-image: + build-and-push-dev-docker-images: runs-on: ubuntu-latest steps: - name: Branch Checkout @@ -20,7 +20,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push + - name: Build and push offat-base docker image uses: docker/build-push-action@v3 with: context: ./src/ @@ -28,26 +28,27 @@ jobs: push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/offat-base:dev platforms: linux/amd64,linux/arm64 - - push-cli-docker-image: - runs-on: ubuntu-latest - steps: - - name: Branch Checkout - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push + - name: Build and push offat docker image uses: docker/build-push-action@v3 with: context: ./src/ - file: ./src/DockerFiles/cli-Dockerfile + file: ./src/DockerFiles/dev/cli-Dockerfile push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/offat:dev - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/amd64,linux/arm64 + - name: Build and push offat-api docker image + uses: docker/build-push-action@v3 + with: + context: ./src/ + file: ./src/DockerFiles/dev/backend-api-Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/offat-api:dev + platforms: linux/amd64,linux/arm64 + - name: Build and push offat-api-worker docker image + uses: docker/build-push-action@v3 + with: + context: ./src/ + file: ./src/DockerFiles/dev/backend-api-worker-Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/offat-api-worker:dev + platforms: linux/amd64,linux/arm64 diff --git a/src/DockerFiles/dev/backend-api-Dockerfile b/src/DockerFiles/dev/backend-api-Dockerfile new file mode 100644 index 0000000..a48ae00 --- /dev/null +++ b/src/DockerFiles/dev/backend-api-Dockerfile @@ -0,0 +1,5 @@ +FROM dmdhrumilmistry/offat-base:dev + +EXPOSE 8000 + +ENTRYPOINT [ "python", "-m", "offat.api" ] diff --git a/src/DockerFiles/dev/backend-api-worker-Dockerfile b/src/DockerFiles/dev/backend-api-worker-Dockerfile new file mode 100644 index 0000000..1c50659 --- /dev/null +++ b/src/DockerFiles/dev/backend-api-worker-Dockerfile @@ -0,0 +1,5 @@ +FROM dmdhrumilmistry/offat-base:dev + +WORKDIR /offat + +ENTRYPOINT [ "rq", "worker", "offat_task_queue" ] diff --git a/src/DockerFiles/dev/cli-Dockerfile b/src/DockerFiles/dev/cli-Dockerfile new file mode 100644 index 0000000..ab0e0dc --- /dev/null +++ b/src/DockerFiles/dev/cli-Dockerfile @@ -0,0 +1,3 @@ +FROM dmdhrumilmistry/offat-base:dev + +ENTRYPOINT [ "offat" ] diff --git a/src/DockerFiles/backend-api-Dockerfile b/src/DockerFiles/main/backend-api-Dockerfile similarity index 100% rename from src/DockerFiles/backend-api-Dockerfile rename to src/DockerFiles/main/backend-api-Dockerfile diff --git a/src/DockerFiles/backend-api-worker-Dockerfile b/src/DockerFiles/main/backend-api-worker-Dockerfile similarity index 100% rename from src/DockerFiles/backend-api-worker-Dockerfile rename to src/DockerFiles/main/backend-api-worker-Dockerfile diff --git a/src/DockerFiles/cli-Dockerfile b/src/DockerFiles/main/cli-Dockerfile similarity index 100% rename from src/DockerFiles/cli-Dockerfile rename to src/DockerFiles/main/cli-Dockerfile