Publish image to docker hub added

This commit is contained in:
2025-01-17 15:36:38 +01:00
parent 4c483daa71
commit 0250e9e33b
3 changed files with 34 additions and 12 deletions

View File

@@ -1,11 +0,0 @@
name: Docker Image CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build . --file Dockerfile --tag hlds:$(date +%s)

33
.github/workflows/docker-publish.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Build and Publish Docker Image
on:
push:
branches:
- main # Trigger on pushes to the 'main' branch
workflow_dispatch: # Allow manual triggering of the workflow
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Log in to Docker Hub using GitHub credentials
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Build the Docker image
- name: Build Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/hl-server:latest .
# Push the Docker image to Docker Hub
- name: Push Docker Image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/hl-server:latest

View File

@@ -1,4 +1,4 @@
[![GitHub Actions Docker Image CI](https://github.com/jjsalinas/hlds-server/workflows/Docker%20Image%20CI/badge.svg)](https://github.com/jjsalians/hl-server/actions) [![GitHub Actions Docker Image CI](https://github.com/jjsalinas/hlds-server/workflows/Docker%20Image%20CI/badge.svg)](https://github.com/jjsalinas/hl-server/actions)
![banner](banner.png) ![banner](banner.png)