Skip to content

Commit

Permalink
fix action to push image to docker hub
Browse files Browse the repository at this point in the history
  • Loading branch information
dreth committed Oct 15, 2024
1 parent 64d87b6 commit 7ddfa42
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/build_and_push_to_docker_hub.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build + run.sh
name: build + push to docker hub

on:
push:
Expand All @@ -17,14 +17,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build container image
run: docker build -t altserver:latest .
# Step 2: Set up Docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Push the image to docker hub
- name: Push image to Docker Hub
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker tag altserver:latest ${{ secrets.DOCKER_USERNAME }}/altserver:latest
docker push ${{ secrets.DOCKER_USERNAME }}/altserver:latest
# Step 3: Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Step 4: Build the Docker image
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/altserver-docker:latest .

# Step 5: Push the Docker image to Docker Hub
- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/altserver-docker:latest

0 comments on commit 7ddfa42

Please sign in to comment.