From 5b40b57760875790de0f109331e86b002df28f5c Mon Sep 17 00:00:00 2001 From: Omar Besbes <86571415+omar-besbes@users.noreply.github.com> Date: Sun, 25 Feb 2024 22:18:21 +0100 Subject: [PATCH] feat: add GitHub workflow to push images to Docker Hub --- .github/workflows/push-images.yml | 38 +++++++++++++++++++++++ Dockerfile | 1 - docker-compose.yml => docker-compose.yaml | 2 ++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/push-images.yml rename docker-compose.yml => docker-compose.yaml (96%) diff --git a/.github/workflows/push-images.yml b/.github/workflows/push-images.yml new file mode 100644 index 0000000..3160321 --- /dev/null +++ b/.github/workflows/push-images.yml @@ -0,0 +1,38 @@ +name: Push Docker images to Docker Hub + +on: + push: + pull_request: + types: + - closed + branches: + - main + - dev + +jobs: + push: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build + run: docker compose build + # These environment variables are required during runtime but not build time. + # As it is not possible to specify this in Docker compose, + # we pass dummy environment variables in order for this step to succeed. + env: + SECRETS_DIR: /this/is/a/dummy/path + SSL_DIR: /this/is/a/dummy/path + + - name: Push + run: docker compose push \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7a01d98..03c326d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,6 @@ WORKDIR app COPY apps apps COPY libs libs COPY *.json . -COPY .yarn .yarn COPY .yarnrc.yml .yarnrc.yml COPY yarn.lock yarn.lock diff --git a/docker-compose.yml b/docker-compose.yaml similarity index 96% rename from docker-compose.yml rename to docker-compose.yaml index 1e16743..796e0d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yaml @@ -29,6 +29,7 @@ services: - head_network head_office: + image: omarbesbes/head_office:latest build: context: . args: @@ -71,6 +72,7 @@ services: - branch_network branch_office: + image: omarbesbes/branch_office:latest build: context: . args: