Sign inSign up

ceramicwhite/pokerogue

By ceramicwhite

Updated almost 2 years ago

with accounts backend included

Image
Web servers
2

10K+

ceramicwhite/pokerogue repository overview

Local in browser storage no accounts:

docker run -d \
--name pokerogue \
--init \
-p 8000:8000 \
ceramicwhite/pokerogue:latest

Run this compose.yml to run with accounts:

services:


  # Use this reverse proxy or add to your own with http://web:8000 and http://server:8001 at /api/
  # Simple reverse proxy that forwards requests to the web and server services
  nginx:
    image: ceramicwhite/pokerogue:nginx-proxy
    container_name: pokerogue-nginx
    restart: unless-stopped
    ports:
      - "80:80"
    depends_on:
      - web
      - server

  web:
    image: ceramicwhite/pokerogue:latest-accounts
    container_name: pokerogue
    init: true
    restart: unless-stopped
    depends_on:
      - server
    # ports:
    #   - 8000:8000

  server:
    image: ceramicwhite/pokerogue:server-latest
    container_name: pokerogue-server
    init: true
    command: ["--debug", "--dbaddr", "db", "--dbuser", "pokerogue", "--dbpass", "pokerogue", "--dbname", "pokeroguedb"]
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    # ports:
    #   - "8001:8001"

  db:
    image: mariadb:11
    container_name: pokerogue-db
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
      start_period: 10s
      start_interval: 10s
      interval: 1m
      timeout: 5s
      retries: 3
    environment:
      MYSQL_ROOT_PASSWORD: admin
      MYSQL_DATABASE: pokeroguedb
      MYSQL_USER: pokerogue
      MYSQL_PASSWORD: pokerogue
    volumes:
      - database:/var/lib/mysql

volumes:
  database:

networks:
  default:
    name: pokerogue-network

example nginx reverse proxy:

server {
    listen 80;

    location / {
        proxy_pass http://web:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /api/ {
        proxy_pass http://server:8001/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        rewrite ^/api/(.*) /$1 break;
    }
}

Dockerfile:

# syntax=docker/dockerfile:1

ARG GIT_TAG=${GIT_TAG:-main}
ARG NODE_VERSION=${NODE_VERSION:-20.13.1}
ARG OS=${OS:-alpine}
ARG VITE_BYPASS_LOGIN=${VITE_BYPASS_LOGIN:-1}
### These seem to still not work, hence the proxy and insertions below
ARG VITE_SERVER_URL=${VITE_SERVER_URL:-http://0.0.0.0:8001}
ARG VITE_API_BASE_URL=${VITE_API_BASE_URL:-http://0.0.0.0:8001}

######################################
FROM node:${NODE_VERSION}-${OS} as base

ENV VITE_BYPASS_TUTORIAL=0 \
    NEXT_TELEMETRY_DISABLED=1

######################################
FROM base as build

ARG GIT_TAG \
    VITE_BYPASS_LOGIN \
    VITE_SERVER_URL \
    VITE_API_BASE_URL

WORKDIR /app

ADD --keep-git-dir=false https://github.com/pagefaultgames/pokerogue.git#${GIT_TAG} /app

RUN --mount=type=cache,target=/root/.npm \
    npm ci

RUN sed -i 's|const serverUrl = .*|const serverUrl = `${window.location.origin}/api`;\n|' src/utils.ts
RUN sed -i 's|export const apiUrl = .*|export const apiUrl = isLocal ? serverUrl : serverUrl;|' src/utils.ts

RUN NODE_OPTIONS=--max-old-space-size=8192 node /usr/local/bin/npm run build

######################################
FROM base as app

ENV NODE_ENV=production \
    PORT=${PORT:-8000}

RUN npm install --location=global vite

USER node

WORKDIR /app

COPY --from=build /app/dist/ .
COPY --from=build /app/package.json ./package.json

EXPOSE $PORT

CMD vite --host --port $PORT

Backend Server Dockerfile:

# syntax=docker/dockerfile:1

ARG GIT_TAG=${GIT_TAG:-master}
ARG GO_VERSION=1.22

FROM golang:${GO_VERSION} AS base

######################################
FROM base as build

ARG GIT_TAG

ADD --keep-git-dir=false https://github.com/pagefaultgames/rogueserver.git#${GIT_TAG} /src

WORKDIR /src

RUN --mount=type=cache,target=/go/pkg/mod \
    go mod download && \
    go mod verify

RUN CGO_ENABLED=0 \
    go build -o rogueserver

RUN chmod +x /src/rogueserver

#######################################

FROM scratch

WORKDIR /app

COPY --from=build /src/rogueserver .

EXPOSE 8001

ENTRYPOINT ["./rogueserver"]
CMD [ "--debug", "--dbaddr", "db", "--dbuser", "pokerogue", "--dbpass", "pokerogue", "--dbname", "pokeroguedb"]

Tag summary

Content type

Image

Digest

sha256:8a1bcf72a

Size

520.1 MB

Last updated

almost 2 years ago

docker pull ceramicwhite/pokerogue