pull/98/merge
Jasper 2024-05-15 15:16:44 -07:00 committed by GitHub
commit 5453160634
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 141 additions and 1 deletions

28
.dockerignore Normal file
View File

@ -0,0 +1,28 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.next
**/.cache
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/build
**/dist
LICENSE
README.md

41
Dockerfile Normal file
View File

@ -0,0 +1,41 @@
# syntax=docker/dockerfile:1
ARG NODE_VERSION=${NODE_VERSION:-18.3.0}
ARG OS=${OS:-alpine}
#####################################
FROM node:${NODE_VERSION}-${OS} as build
ENV VITE_BYPASS_LOGIN=1 \
VITE_BYPASS_TUTORIAL=0 \
NEXT_TELEMETRY_DISABLED=1
WORKDIR /app
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci
COPY . .
RUN npm run build
######################################
FROM node:${NODE_VERSION}-${OS} 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 npm run start -- --host --port $PORT

26
Dockerfile.dev Normal file
View File

@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1
ARG NODE_VERSION=${NODE_VERSION:-18.3.0}
ARG OS=${OS:-alpine}
######################################
FROM node:${NODE_VERSION}-${OS} as dev
ENV VITE_BYPASS_LOGIN=1 \
VITE_BYPASS_TUTORIAL=0 \
NODE_ENV=development
USER node
WORKDIR /app
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci
COPY --chown=node:node . .
EXPOSE 8000
CMD npm run start:dev -- --host --port 8000

View File

@ -14,7 +14,12 @@ If you have the motivation and experience with Typescript/Javascript (or are wil
#### Running Locally #### Running Locally
1. Clone the repo and in the root directory run `npm install` 1. Clone the repo and in the root directory run `npm install`
- *if you run into any errors, reach out in the **#dev-corner** channel in discord* - *if you run into any errors, reach out in the **#dev-corner** channel in discord*
2. Run `npm run start:dev` to locally run the project in `localhost:8000` 2. Run `npm run start:dev` to locally run the project in `localhost:8000` or `npm run start:dev:docker` to run in a docker container
### 🐳 Docker Selfhost
1. Clone the repo and in the root directory run `docker compose up -d`
2. The project will be running on `localhost:8000`
### ❔ FAQ ### ❔ FAQ

39
compose.yaml Normal file
View File

@ -0,0 +1,39 @@
services:
web:
build:
context: .
image: pagefaultgames/pokerogue
container_name: pokerogue
init: true
environment:
PORT: 8000
ports:
- 8000:8000
profiles: [""]
dev:
build:
context: .
dockerfile: ./Dockerfile.dev
environment:
NODE_ENV: development
command: npm run start:dev -- --host --port 8000
develop:
watch:
- action: sync
path: ./src
target: /app/src
ignore:
- node_modules/
- action: sync
path: ./public
target: /app/public
ignore:
- node_modules/
- action: rebuild
path: ./package.json
- action: rebuild
path: ./package-lock.json
ports:
- 8000:8000
profiles: ["dev"]

View File

@ -6,6 +6,7 @@
"scripts": { "scripts": {
"start": "vite", "start": "vite",
"start:dev": "vite --mode development", "start:dev": "vite --mode development",
"start:dev:docker": "docker compose --profile dev watch -d",
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"test": "vitest run", "test": "vitest run",