forked from y-young/nazurin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (32 loc) · 1.33 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
ARG PYTHON_VERSION=3.8
# Builder
FROM python:${PYTHON_VERSION}-alpine as builder
RUN apk add --update git build-base libffi-dev
WORKDIR /root
# Install requirements
COPY requirements.txt /root
RUN pip install --prefix="/install" --no-warn-script-location -r requirements.txt
# Install FFmpeg
ARG TARGETARCH
ARG FFMPEG_VERSION=4.2.2
RUN echo "Download from https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-${FFMPEG_VERSION}-${TARGETARCH}-static.tar.xz" && \
wget https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-${FFMPEG_VERSION}-${TARGETARCH}-static.tar.xz -O ffmpeg.tar.xz && \
tar Jxvf ./ffmpeg.tar.xz && \
cp ./ffmpeg-${FFMPEG_VERSION}-${TARGETARCH}-static/ffmpeg /usr/local/bin/
# Runtime
FROM python:${PYTHON_VERSION}-alpine
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
RUN apk add --no-cache curl
# Install FFmpeg
COPY --from=builder /usr/local/bin/ffmpeg /usr/local/bin/
# Copy pip requirements
COPY --from=builder /install /usr/local
WORKDIR /app
COPY nazurin ./nazurin
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
CMD ["python", "-m", "nazurin"]