tons of stuff but working again
This commit is contained in:
36
Dockerfile
36
Dockerfile
@ -2,31 +2,35 @@ FROM python:3.11-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Install build deps and netcat for the DB-wait
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
default-libmysqlclient-dev \
|
||||
pkg-config \
|
||||
netcat-openbsd \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# 1) Install build deps, netcat, curl—and gosu for privilege dropping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
gcc \
|
||||
default-libmysqlclient-dev \
|
||||
pkg-config \
|
||||
netcat-openbsd \
|
||||
curl \
|
||||
gosu \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 2) Copy & install Python requirements
|
||||
COPY requirements.txt .
|
||||
RUN pip install --upgrade pip \
|
||||
&& pip install -r requirements.txt
|
||||
|
||||
# 3) Copy the rest of the app
|
||||
COPY . .
|
||||
|
||||
# Create a non-root user and give it ownership of /app
|
||||
RUN useradd -ms /bin/bash appuser \
|
||||
&& chown -R appuser:appuser /app
|
||||
# 4) Create the non-root user and make sure the upload dir exists and is chown’d
|
||||
RUN groupadd -g 1000 appuser \
|
||||
&& useradd -u 1000 -ms /bin/bash -g appuser appuser \
|
||||
&& mkdir -p /app/data/uploads \
|
||||
&& chown -R appuser:appuser /app/data/uploads
|
||||
|
||||
# Switch to appuser for everything below
|
||||
USER appuser
|
||||
|
||||
# Prepare entrypoint
|
||||
COPY --chown=appuser:appuser entrypoint.sh /entrypoint.sh
|
||||
# 5) Install the entrypoint (keep this as root so it can chown the volume at runtime)
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
Reference in New Issue
Block a user