-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathDockerfile
45 lines (35 loc) · 1.38 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
FROM python:3.10-slim
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies (including FFmpeg and libsndfile)
RUN apt-get update && \
apt-get install -y build-essential cmake ffmpeg wget pkg-config \
libavcodec-dev libavformat-dev libavfilter-dev \
libavdevice-dev libswscale-dev libsndfile-dev git && \
apt-get clean
WORKDIR /app
# Copy the project into the container
COPY . /app
# Handle library wrt arch
# This is used in CI to avoid having separate images per arch
ARG TARGETPLATFORM
RUN echo "Detected platform: ${TARGETPLATFORM}" && \
case "${TARGETPLATFORM}" in \
"linux/amd64") cp /app/MediaProcessor/lib/libdf-linux-amd64.so /app/MediaProcessor/lib/libdf.so ;; \
"linux/arm64") cp /app/MediaProcessor/lib/libdf-linux-arm64.so /app/MediaProcessor/lib/libdf.so ;; \
*) echo "Unsupported platform: ${TARGETPLATFORM}" && exit 1 ;; \
esac
# Compile the C++ project with a fresh CMakeCache
RUN mkdir -p MediaProcessor/build && \
cd MediaProcessor/build && \
rm -rf CMakeCache.txt CMakeFiles _deps && \
cmake .. && \
make
# Install python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Set Flask environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=development
# Expose the port for Flask
EXPOSE 8080
# Run Flask application
CMD ["flask", "run", "--host=0.0.0.0", "--port=8080"]