diff --git a/.github/workflows/build_and_push_to_docker_hub.yml b/.github/workflows/build_and_push_to_docker_hub.yml index 7274f55..ffd8c3e 100644 --- a/.github/workflows/build_and_push_to_docker_hub.yml +++ b/.github/workflows/build_and_push_to_docker_hub.yml @@ -1,4 +1,4 @@ -name: build + run.sh +name: build + push to docker hub on: push: @@ -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