Docker and Docker-Compose updates (#13)

* feat: updated docker-compose files to pull an image from docker hub
This commit is contained in:
Michael Green
2023-07-11 22:31:08 +10:00
committed by GitHub
parent 7f4b8a808f
commit f1842d21ff
4 changed files with 75 additions and 3 deletions

34
.github/workflows/BuildDockerOnTag.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Build Docker Image on New Tag
on:
push:
tags:
- '*'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64 #,linux/arm64
push: true
tags: gaseousgames/gaseousserver:latest,gaseousgames/gaseousserver:${{ github.ref_name}}

View File

@@ -7,7 +7,7 @@ COPY . ./
# Restore as distinct layers
RUN dotnet restore "gaseous-server/gaseous-server.csproj"
# Build and publish a release
RUN dotnet publish "gaseous-server/gaseous-server.csproj" -c Release -o out
RUN dotnet publish "gaseous-server/gaseous-server.csproj" --use-current-runtime --self-contained false -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0

39
docker-compose-build.yml Normal file
View File

@@ -0,0 +1,39 @@
version: '2'
services:
gaseous-server:
container_name: gaseous-server
build:
context: ./
restart: unless-stopped
networks:
- gaseous
depends_on:
- gsdb
ports:
- 5198:80
volumes:
- gs:/root/.gaseous-server
environment:
- dbhost=gsdb
- dbuser=root
- dbpass=gaseous
- igdbclientid=<clientid>
- igdbclientsecret=<clientsecret>
gsdb:
container_name: gsdb
image: mysql:8
restart: unless-stopped
networks:
- gaseous
volumes:
- gsdb:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=gaseous
- MYSQL_USER=gaseous
- MYSQL_PASSWORD=gaseous
networks:
gaseous:
driver: bridge
volumes:
gs:
gsdb:

View File

@@ -2,8 +2,7 @@ version: '2'
services:
gaseous-server:
container_name: gaseous-server
build:
context: ./
image: gaseousgames/gaseousserver:latest
restart: unless-stopped
networks:
- gaseous