diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..219c096336b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +# .dockerignore +node_modules +*.log +*.md +.gitignore +Dockerfile +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index bfba5cabcdf..7e8af3699bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,50 +4,44 @@ ARG OS=alpine FROM node:${NODE_VERSION}-${OS} -# Create non-root user for rootless operation +# Create non-root user RUN addgroup -S appgroup && adduser -S appuser -G appgroup -# Install git (already present, but ensure it’s available) +# Install git (for potential runtime needs) RUN apk add --no-cache git -# Set environment variables -ENV VITE_BYPASS_LOGIN=1 \ - VITE_BYPASS_TUTORIAL=0 \ - NEXT_TELEMETRY_DISABLED=1 \ - PNP_HOME=/home/appuser/.shrc \ - NODE_ENV=production \ - PORT=8000 - # Set working directory WORKDIR /app # Enable and prepare pnpm RUN corepack enable && corepack prepare pnpm@10 --activate -# Copy package files first for caching -COPY package.json pnpm-lock.yaml ./ - -# Initialize Git repository and copy .git (for submodules and lefthook) -COPY .git ./.git -COPY .gitmodules ./.gitmodules - -# Install dependencies and initialize submodules -RUN --mount=type=cache,target=/home/appuser/.pnpm-store \ - git config --global --add safe.directory /app && \ - git submodule update --init --recursive && \ - pnpm install --frozen-lockfile - -# Copy remaining files COPY . . -# Change ownership for rootless compatibility +# Copy package files +COPY package.json pnpm-lock.yaml ./ + +# Install all dependencies, skipping postinstall +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 -CMD ["pnpm", "start:podman", "--", "--host", "--port", "$PORT"] \ No newline at end of file +# Start the app in development mode +CMD ["pnpm", "run", "start:podman"] \ No newline at end of file diff --git a/docs/podman.md b/docs/podman.md new file mode 100644 index 00000000000..9cd6a2777a3 --- /dev/null +++ b/docs/podman.md @@ -0,0 +1,6 @@ +# Using with Podman + +1. `podman build -t pokerogue:1.0 -f Dockerfile .` +2. `podman run --rm -p 8000:8000 localhost/pokerogue:1.0` +3. Visit `http://localhost:8000/` +