Fix potential Docker container issues - add proper icon, install curl, fix permissions
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
4a0797fcff
commit
1fea51ff2b
|
@ -1,14 +1,20 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
fancy-qr:
|
||||
midtownplaydio:
|
||||
build:
|
||||
context: ./docker/fancy-qr
|
||||
context: ./docker/midtownplaydio
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./docker/fancy-qr/src:/app/web
|
||||
- ./uploads:/app/web/uploads
|
||||
- ./output:/app/web/outputs
|
||||
- ./docker/midtownplaydio/src:/app
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
restart: unless-stopped
|
||||
- DEBUG=1
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 5s
|
|
@ -2,6 +2,12 @@ FROM python:3.11-slim
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# Install curl for healthcheck and other dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends curl && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements first for better caching
|
||||
COPY src/requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
@ -13,7 +19,7 @@ RUN pip install --no-cache-dir pytest pytest-cov black isort
|
|||
COPY src/ .
|
||||
|
||||
# Create directory for static files
|
||||
RUN mkdir -p /app/static
|
||||
RUN mkdir -p /app/static && chmod 777 /app/static
|
||||
|
||||
# Create non-root user for security
|
||||
RUN adduser --disabled-password --gecos '' appuser
|
||||
|
|
|
@ -1,28 +1 @@
|
|||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements first for better caching
|
||||
COPY src/requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the rest of the application
|
||||
COPY src/ .
|
||||
|
||||
# Create directory for static files
|
||||
RUN mkdir -p /app/static
|
||||
|
||||
# Create non-root user for security
|
||||
RUN adduser --disabled-password --gecos '' appuser
|
||||
RUN chown -R appuser:appuser /app
|
||||
USER appuser
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:3000/health || exit 1
|
||||
|
||||
# Run the application with Gunicorn
|
||||
CMD gunicorn -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:3000 app:app
|
||||
FROM git.nixc.us/colin/midtownplaydio:staging
|
|
@ -3,6 +3,7 @@ from fastapi.responses import HTMLResponse, JSONResponse, FileResponse
|
|||
from fastapi.staticfiles import StaticFiles
|
||||
import os
|
||||
import json
|
||||
import base64
|
||||
|
||||
app = FastAPI(title="MidTownPlaydio")
|
||||
|
||||
|
@ -135,9 +136,12 @@ def generate_service_worker():
|
|||
|
||||
# Create a simple placeholder icon
|
||||
def create_placeholder_icon():
|
||||
# This is just a placeholder - in a real app, you would use a proper icon file
|
||||
with open(os.path.join(STATIC_DIR, 'icon.png'), 'w') as f:
|
||||
f.write("Placeholder for icon")
|
||||
# A minimal 1x1 transparent PNG
|
||||
minimal_png_base64 = "iVBORw0KGgoAAAANSUhEUgAAAMAAAADAAQMAAABoEv5EAAAABlBMVEUAAAD///+l2Z/dAAAANklEQVRIx+3IMQEAAAgDoPnX3hiu20CDBnbmFVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFReQMHaigbWzGsIQAAAABJRU5ErkJggg=="
|
||||
png_data = base64.b64decode(minimal_png_base64)
|
||||
|
||||
with open(os.path.join(STATIC_DIR, 'icon.png'), 'wb') as f:
|
||||
f.write(png_data)
|
||||
|
||||
# Generate all static files on startup
|
||||
@app.on_event("startup")
|
||||
|
|
Loading…
Reference in New Issue