mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 15:03:24 +02:00
[Dev] Add Podman support (#6150)
* Add Dockerfile * Refactor for improved podman support * Podman support + docs * Update documentation for podman usage * Update docs/podman.md with working podman run command * Add package manager constraint to package.json and Dockerfile Update podman.md docs * Remove package manager constraints from github workflows per DayKev Update podman.md docs with extra steps for locales and testing command Remove missleading comment from Dockerfile * Remove Dockerfile comment * Re-add `pnpm` version to Github Pages workflow * Mention podman in CONTRIBUTING.md Fix typo in docs/podman.md test command * Fix path to docs/podman.md --------- Co-authored-by: Lugiad <adrien.grivel@hotmail.fr> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
parent
e570c2eba5
commit
65c72c65b9
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
# .dockerignore
|
||||
node_modules
|
||||
*.log
|
||||
*.md
|
||||
.gitignore
|
||||
Dockerfile
|
||||
.env
|
2
.github/workflows/deploy-beta.yml
vendored
2
.github/workflows/deploy-beta.yml
vendored
@ -22,8 +22,6 @@ jobs:
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@ -20,8 +20,6 @@ jobs:
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
2
.github/workflows/linting.yml
vendored
2
.github/workflows/linting.yml
vendored
@ -30,8 +30,6 @@ jobs:
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
|
2
.github/workflows/test-shard-template.yml
vendored
2
.github/workflows/test-shard-template.yml
vendored
@ -32,8 +32,6 @@ jobs:
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
|
@ -80,7 +80,8 @@ Notable topics include:
|
||||
- [Commenting your code](./docs/comments.md)
|
||||
- [Linting & Formatting](./docs/linting.md)
|
||||
- [Localization](./docs/localization.md)
|
||||
- [Enemy AI move selection](./docs/enemy-ai.md)
|
||||
- [Enemy AI move selection](./docs/enemy-ai.md)
|
||||
- [Running with Podman](./docs/podman.md)
|
||||
|
||||
Again, if you have unanswered questions please feel free to ask!
|
||||
|
||||
|
47
Dockerfile
Normal file
47
Dockerfile
Normal file
@ -0,0 +1,47 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
ARG NODE_VERSION=22.14
|
||||
ARG OS=alpine
|
||||
|
||||
FROM node:${NODE_VERSION}-${OS}
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
|
||||
# Install git (for potential runtime needs)
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Enable and prepare pnpm
|
||||
RUN corepack enable && corepack prepare pnpm@10.14.0 --activate
|
||||
|
||||
COPY . .
|
||||
|
||||
# Copy package files
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Install all dependencies
|
||||
RUN --mount=type=cache,target=/home/appuser/.pnpm-store \
|
||||
pnpm install --frozen-lockfile && \
|
||||
rm -rf /home/appuser/.pnpm-store/*
|
||||
|
||||
# Change ownership
|
||||
RUN chown -R appuser:appgroup /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER appuser
|
||||
|
||||
# Set environment variables
|
||||
ENV VITE_BYPASS_LOGIN=1 \
|
||||
VITE_BYPASS_TUTORIAL=0 \
|
||||
NEXT_TELEMETRY_DISABLED=1 \
|
||||
PNP_HOME=/home/appuser/.shrc \
|
||||
NODE_ENV=development \
|
||||
PORT=8000
|
||||
|
||||
# Expose port
|
||||
EXPOSE $PORT
|
||||
|
||||
# Start the app in development mode
|
||||
CMD ["pnpm", "run", "start:podman"]
|
27
docs/podman.md
Normal file
27
docs/podman.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Using Podman
|
||||
|
||||
## Requirements
|
||||
|
||||
* `podman >=5.x`
|
||||
|
||||
## Steps
|
||||
|
||||
1. `podman build -t pokerogue -f Dockerfile .`
|
||||
2. `podman create --name temp-pokerogue localhost/pokerogue`
|
||||
3. `podman cp temp-pokerogue:/app/node_modules ./`
|
||||
4. `podman cp temp-pokerogue:/app/public/locales ./public/`
|
||||
5. `podman rm temp-pokerogue`
|
||||
6. `podman run --rm -p 8000:8000 -v $(pwd):/app:Z --userns=keep-id -u $(id -u):$(id -g) localhost/pokerogue`
|
||||
7. Visit `http://localhost:8000/`
|
||||
|
||||
Note:
|
||||
|
||||
1. Steps 2,3,4 are required because mounting working directory without installed `node_modules/` and assets locally will be empty,
|
||||
this way we prevent it by copying them from the container itself to local directory
|
||||
|
||||
2. `podman run` may take a couple of minutes to mount the working directory
|
||||
|
||||
### Running tests inside container
|
||||
|
||||
`podman run --rm -p 8000:8000 -v $(pwd):/app:Z --userns=keep-id -u $(id -u):$(id -g) localhost/pokerogue pnpm test:silent
|
||||
`
|
@ -7,6 +7,7 @@
|
||||
"start:prod": "vite --mode production",
|
||||
"start:beta": "vite --mode beta",
|
||||
"start:dev": "vite --mode development",
|
||||
"start:podman": "vite --mode development --host 0.0.0.0 --port $PORT",
|
||||
"build": "vite build",
|
||||
"build:beta": "vite build --mode beta",
|
||||
"preview": "vite preview",
|
||||
@ -71,5 +72,6 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@10.14.0"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user