From a7e7c2fb95b48282987daa299bfde72463c90ce3 Mon Sep 17 00:00:00 2001 From: RZFeeser Date: Tue, 23 Sep 2025 02:29:10 +0000 Subject: [PATCH 1/2] updates --- .github/workflows/docker-flask.yml | 42 ++++++++++++++++++++++++++++++ Dockerfile | 25 ++++++++++++++++++ requirements.txt | 1 + 3 files changed, 68 insertions(+) create mode 100644 .github/workflows/docker-flask.yml create mode 100644 Dockerfile create mode 100644 requirements.txt diff --git a/.github/workflows/docker-flask.yml b/.github/workflows/docker-flask.yml new file mode 100644 index 0000000..3bd1995 --- /dev/null +++ b/.github/workflows/docker-flask.yml @@ -0,0 +1,42 @@ +name: Build and Publish Flask App Docker Image + +on: + push: + branches: + - '**' + +jobs: + build-and-publish: + runs-on: ubuntu-latest + env: + IMAGE_NAME: ${{ github.repository }} + BRANCH_TAG: ${{ github.ref_name }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker image + run: | + docker build -t ghcr.io/${{ github.repository }}:${{ env.BRANCH_TAG }} . + + - name: Run container for 10 seconds + run: | + docker run -d --name flask-test -p 5006:5006 ghcr.io/${{ github.repository }}:${{ env.BRANCH_TAG }} + sleep 10 + docker ps | grep flask-test + docker stop flask-test + docker rm flask-test + + - name: Push Docker image to GitHub Package Registry + run: | + docker push ghcr.io/${{ github.repository }}:${{ env.BRANCH_TAG }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1d286d5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# Use official Python image +FROM python:3.11-slim + +# Set working directory +WORKDIR /app + +# Copy only necessary files +COPY requirements.txt ./ +COPY rpgserver.py ./ +COPY roomlogic.py ./ +COPY usercommands.py ./ +COPY world.json ./ +COPY endgame.json ./ +COPY templates/ ./templates/ +COPY images/ ./images/ +COPY research/ ./research/ + +# Install dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Expose Flask port +EXPOSE 5006 + +# Run the Flask app +CMD ["python", "rpgserver.py"] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e3e9a71 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask From 9782e926bdda0a7ced9f4b302f081c3d2688c553 Mon Sep 17 00:00:00 2001 From: RZFeeser Date: Mon, 22 Sep 2025 22:32:35 -0400 Subject: [PATCH 2/2] Update Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1d286d5..394327b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,6 @@ COPY world.json ./ COPY endgame.json ./ COPY templates/ ./templates/ COPY images/ ./images/ -COPY research/ ./research/ # Install dependencies RUN pip install --no-cache-dir -r requirements.txt