Files
infoscreen/Dockerfile
2025-06-10 22:54:55 +02:00

57 lines
1.6 KiB
Docker

```dockerfile
# Use a stable Python base image
FROM python:3.11-slim
# Build arguments for host user mapping
ARG USER_ID=1000
ARG GROUP_ID=1000
# Create non-root user
RUN groupadd -g ${GROUP_ID} infoscreen_taa \
&& useradd -u ${USER_ID} -g ${GROUP_ID} --shell /bin/bash --create-home infoscreen_taa
# Ensure user exists
RUN getent passwd infoscreen_taa
# Install locale dependencies and generate UTF-8 locale
RUN apt-get update && apt-get install -y locales \
&& sed -i 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen
# Set environment variables for locale
ENV LANG=de_DE.UTF-8 \
LANGUAGE=de_DE:de \
LC_ALL=de_DE.UTF-8
# Enable Dash debug during development
ENV DASH_DEBUG_MODE=True
# Working directory inside container
WORKDIR /app # entspricht mount in devcontainer.json
# Copy only requirements first for efficient caching
COPY server/requirements-dev.txt ./
# Install dev dependencies under the non-root user
USER infoscreen_taa
RUN pip install --upgrade pip \
&& pip install --user -r requirements-dev.txt
# Switch back to root to copy source files and fix permissions
USER root
# Copy the server application code into /app
COPY server/ /app
RUN chown -R infoscreen_taa:infoscreen_taa /app
# Create config directory under the non-root user's home
RUN mkdir -p /home/infoscreen_taa/.config/Infoscreen-Server \
&& chown -R infoscreen_taa:infoscreen_taa /home/infoscreen_taa/.config/Infoscreen-Server
# Expose development ports
EXPOSE 8000 8050
# Use a long-running process so the container stays alive
CMD ["tail", "-f", "/dev/null"]
```