|
FROM python:3.11-bullseye
|
|
|
|
# We don't want to run our application as root if it is not strictly necessary, even in a container.
|
|
# Create a user and a group called 'app' to run the processes.
|
|
RUN adduser app
|
|
|
|
# Place the application components in a dir below the root dir
|
|
COPY requirements.txt /app/requirements.txt
|
|
|
|
# Make the directory the working directory for subsequent commands
|
|
WORKDIR /app
|
|
|
|
# Install from the requirements.txt we copied above
|
|
RUN pip install -r requirements.txt
|
|
|
|
# Download dbmate
|
|
RUN mkdir /app/bin
|
|
RUN curl -fsSL -o /app/bin/dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-amd64
|
|
RUN chmod +x /app/bin/dbmate
|
|
|
|
RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /app/bin/yt-dlp
|
|
RUN chmod +x /app/bin/yt-dlp
|
|
|
|
RUN apt-get update && \
|
|
apt-get -y --no-install-recommends install software-properties-common && \
|
|
add-apt-repository "deb http://httpredir.debian.org/debian testing main" && \
|
|
apt-get update && \
|
|
apt-get -t testing install -y --no-install-recommends python3 ffmpeg
|
|
|
|
# Place the application components in a dir below the root dir
|
|
COPY . /app
|
|
|
|
# Hand everything over to the 'app' user
|
|
RUN chown -R app:app /app
|
|
|
|
# Subsequent commands, either in this Dockerfile or in a
|
|
# docker-compose.yml, will run as user 'app'
|
|
USER app
|
|
|
|
# We are done with setting up the image.
|
|
# As this image is used for different
|
|
# purposes and processes no CMD or ENTRYPOINT is specified here,
|
|
# this is done in docker-compose.yml.
|
|
|
|
#RUN mkdir $HOME/.cache
|
|
#RUN chown -R app:app $HOME/app
|
|
|
|
RUN bin/dbmate up
|