Compare commits
1 Commits
main
...
607836b280
| Author | SHA1 | Date | |
|---|---|---|---|
| 607836b280 |
-57
@@ -1,57 +0,0 @@
|
|||||||
FROM python:3.13-slim
|
|
||||||
|
|
||||||
# Install FFmpeg and dependencies required for gosu installation
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
ffmpeg \
|
|
||||||
ca-certificates \
|
|
||||||
wget \
|
|
||||||
gnupg \
|
|
||||||
dirmngr \
|
|
||||||
gnupg-agent && \
|
|
||||||
apt-get clean && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install gosu (lightweight tool for dropping privileges)
|
|
||||||
RUN set -eux; \
|
|
||||||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
|
|
||||||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.17/gosu-$dpkgArch"; \
|
|
||||||
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.17/gosu-$dpkgArch.asc"; \
|
|
||||||
export GNUPGHOME="$(mktemp -d)"; \
|
|
||||||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
|
|
||||||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
|
|
||||||
gpgconf --kill all; \
|
|
||||||
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
|
|
||||||
chmod +x /usr/local/bin/gosu; \
|
|
||||||
gosu --version
|
|
||||||
|
|
||||||
# Set Python environment variables
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
||||||
PYTHONUNBUFFERED=1
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy package metadata and source code
|
|
||||||
COPY setup.py pyproject.toml README.md ./
|
|
||||||
COPY audio_splitter/ ./audio_splitter/
|
|
||||||
|
|
||||||
# Install the package
|
|
||||||
RUN pip install --no-cache-dir .
|
|
||||||
|
|
||||||
# Create a non-root user with UID 1000
|
|
||||||
RUN addgroup --system --gid 1000 appgroup && \
|
|
||||||
adduser --system --uid 1000 --ingroup appgroup appuser
|
|
||||||
|
|
||||||
# Change ownership of /app to the container user (so it can write there if needed)
|
|
||||||
RUN chown -R appuser:appgroup /app
|
|
||||||
|
|
||||||
# Copy the entrypoint script
|
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
||||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
||||||
|
|
||||||
# Set the entrypoint
|
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
||||||
|
|
||||||
# Default command (shows help if no arguments provided)
|
|
||||||
CMD ["--help"]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Check if we are running as root (default)
|
|
||||||
if [ "$(id -u)" = "0" ]; then
|
|
||||||
# If /data is a directory, change its ownership to the container user
|
|
||||||
if [ -d "/data" ]; then
|
|
||||||
echo "Setting ownership of /data to appuser:appgroup"
|
|
||||||
chown -R appuser:appgroup /data
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Drop privileges and run audio_splitter with the provided arguments
|
|
||||||
exec gosu appuser audio_splitter "$@"
|
|
||||||
else
|
|
||||||
# If not root, just run audio_splitter directly
|
|
||||||
# It's not supposed to be called
|
|
||||||
exec audio_splitter "$@"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user