unraid
This commit is contained in:
26
Dockerfile
26
Dockerfile
@@ -32,6 +32,9 @@ RUN npm run build
|
||||
# Stage 3: Production Runtime
|
||||
FROM node:20-alpine
|
||||
|
||||
# Install su-exec and shadow (for usermod/groupmod)
|
||||
RUN apk add --no-cache su-exec shadow
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy backend package files
|
||||
@@ -48,17 +51,20 @@ COPY --from=backend-builder /app/backend/dist ./dist
|
||||
COPY --from=frontend-builder /app/frontend/dist ./dist/public
|
||||
|
||||
# Create temp upload directory
|
||||
RUN mkdir -p /app/temp && \
|
||||
chown -R node:node /app
|
||||
RUN mkdir -p /app/temp
|
||||
|
||||
# Switch to non-root user
|
||||
USER node
|
||||
# Copy entrypoint script
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
# Environment variables (can be overridden via Unraid UI)
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV MAX_FILE_SIZE=10485760
|
||||
ENV TEMP_DIR=/app/temp
|
||||
# Environment variables (Unraid defaults and App defaults)
|
||||
ENV PUID=99 \
|
||||
PGID=100 \
|
||||
TZ=UTC \
|
||||
NODE_ENV=production \
|
||||
PORT=3000 \
|
||||
MAX_FILE_SIZE=10485760 \
|
||||
TEMP_DIR=/app/temp
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
@@ -67,5 +73,7 @@ EXPOSE 3000
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:3000/', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
# Start server
|
||||
CMD ["node", "dist/index.js"]
|
||||
66
UNRAID.md
Normal file
66
UNRAID.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# Unraid Installation Guide for PNGer
|
||||
|
||||
This guide walks you through installing PNGer on Unraid using the Docker tab and "Add Container" feature.
|
||||
|
||||
## Requirements
|
||||
- Unraid OS with Docker enabled.
|
||||
- Appdata path ready (optional, if you want persistent temp storage).
|
||||
|
||||
## Step-by-Step Installation
|
||||
|
||||
1. Log into your Unraid WebGUI and navigate to the **Docker** tab.
|
||||
2. Scroll to the bottom and click on **Add Container**.
|
||||
3. Fill in the following details:
|
||||
- **Name**: `PNGer`
|
||||
- **Repository**: `jason/pnger:latest` (or the repository you pushed the image to, e.g., `ghcr.io/yourusername/pnger:latest` if hosted, or `pnger:latest` if built locally).
|
||||
- **Network Type**: `Bridge`
|
||||
|
||||
4. Click on **+ Add another Path, Port, Variable, Label or Device** to add the required parameters.
|
||||
|
||||
### Port Configuration
|
||||
- **Config Type**: `Port`
|
||||
- **Name**: `WebUI`
|
||||
- **Container Port**: `3000`
|
||||
- **Host Port**: `8080` (or whichever port is free on your Unraid system).
|
||||
- **Connection Protocol**: `TCP`
|
||||
|
||||
### Environment Variables
|
||||
Add the following variables by clicking **+ Add another Path, Port, Variable...** and selecting **Variable** as the Config Type:
|
||||
|
||||
1. **PUID**
|
||||
- **Name**: `User ID (PUID)`
|
||||
- **Key**: `PUID`
|
||||
- **Value**: `99` (Unraid's nobody user).
|
||||
|
||||
2. **PGID**
|
||||
- **Name**: `Group ID (PGID)`
|
||||
- **Key**: `PGID`
|
||||
- **Value**: `100` (Unraid's users group).
|
||||
|
||||
3. **TZ**
|
||||
- **Name**: `Timezone`
|
||||
- **Key**: `TZ`
|
||||
- **Value**: `America/New_York` (Enter your specific Timezone here).
|
||||
|
||||
4. **MAX_FILE_SIZE** (Optional)
|
||||
- **Name**: `Max Upload Size (Bytes)`
|
||||
- **Key**: `MAX_FILE_SIZE`
|
||||
- **Value**: `10485760` (Default is 10MB; 10485760 bytes).
|
||||
|
||||
### Volume Mapping (Optional)
|
||||
If you require persistence for the temporary directory processing uploads (usually not required):
|
||||
- **Config Type**: `Path`
|
||||
- **Name**: `Temp Processing Dir`
|
||||
- **Container Path**: `/app/temp`
|
||||
- **Host Path**: `/mnt/user/appdata/pnger/temp`
|
||||
|
||||
5. **Apply Settings**:
|
||||
- Scroll to the bottom and press **Apply**. Unraid will pull the image and create the container with the specified settings.
|
||||
|
||||
## Accessing PNGer
|
||||
Once the container states "started", you can access the Web GUI by navigating to your Unraid IP and the port you assigned (e.g., `http://192.168.1.100:8080`).
|
||||
|
||||
---
|
||||
|
||||
**Troubleshooting:**
|
||||
If the container stops instantly, check the **Logs** in Unraid. Ensure that the port you selected on the host is not already in use by another container (like a web server or another app).
|
||||
@@ -10,10 +10,11 @@ services:
|
||||
ports:
|
||||
- "${HOST_PORT:-8080}:3000"
|
||||
environment:
|
||||
- PUID=${PUID:-99}
|
||||
- PGID=${PGID:-100}
|
||||
- TZ=${TZ:-UTC}
|
||||
- NODE_ENV=${NODE_ENV:-production}
|
||||
- PORT=3000
|
||||
- MAX_FILE_SIZE=${MAX_FILE_SIZE:-10485760}
|
||||
- TEMP_DIR=/app/temp
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
|
||||
|
||||
23
docker-entrypoint.sh
Normal file
23
docker-entrypoint.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Default to PUID 99 and PGID 100 if not specified
|
||||
PUID=${PUID:-99}
|
||||
PGID=${PGID:-100}
|
||||
|
||||
echo "Starting with UID: $PUID, GID: $PGID"
|
||||
|
||||
# Modify the 'node' user and group to match the provided PUID/PGID
|
||||
if [ "$(id -u node)" -ne "$PUID" ]; then
|
||||
usermod -o -u "$PUID" node
|
||||
fi
|
||||
|
||||
if [ "$(id -g node)" -ne "$PGID" ]; then
|
||||
groupmod -o -g "$PGID" node
|
||||
fi
|
||||
|
||||
# Ensure appropriate permissions on the application directory and temp dir
|
||||
chown -R node:node /app
|
||||
|
||||
# Drop privileges to 'node' user and execute the command passed to the container
|
||||
exec su-exec node "$@"
|
||||
Reference in New Issue
Block a user