Skip to content

Commit

Permalink
feature: push and pull from dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeav527 committed Jun 5, 2024
1 parent dcedae0 commit 0c8ea60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
CD:
needs: CI
runs-on:
- self-hosted
- staging
- self-hosted
- staging

steps:
- name: Checkout the latest code
Expand All @@ -42,19 +42,25 @@ jobs:
- name: Docker Hub login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Remove specific old containers if they exist
run: |
docker stop rest-api-staging || true
docker rm rest-api-staging || true
- name: Pull the Docker image
- name: Pull the Docker images
run: |
cd $GITHUB_WORKSPACE
docker compose -f docker-compose.yml pull
cd $GITHUB_WORKSPACE
docker compose -f docker-compose.yml pull rest-api
- name: Start the container
- name: Start the containers
run: |
cd $GITHUB_WORKSPACE
docker compose -f docker-compose.yml up -d
cd $GITHUB_WORKSPACE
docker compose -f docker-compose.yml up -d rest-api
- name: Remove old Docker images
run: |
docker rmi $(docker images devroadr/python-api-server -f "dangling=true" -q) || true
docker rmi $(docker images -f "dangling=true" -q) || true
# docker rmi $(docker images devroadr/python-api-server -f "dangling=true" -q) || true
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
services:
rest-api:
image: devroadr/cdci_rust
container_name: rest-api-staging
image: devroadr/cdci_rust:staging
build:
context: .
dockerfile: Dockerfile
Expand Down

0 comments on commit 0c8ea60

Please sign in to comment.