Skip to content

Commit

Permalink
feat: add GitHub workflow to push images to Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-besbes committed Feb 25, 2024
1 parent aceb2d9 commit 5b40b57
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/push-images.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml → docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
- head_network

head_office:
image: omarbesbes/head_office:latest
build:
context: .
args:
Expand Down Expand Up @@ -71,6 +72,7 @@ services:
- branch_network

branch_office:
image: omarbesbes/branch_office:latest
build:
context: .
args:
Expand Down

0 comments on commit 5b40b57

Please sign in to comment.