-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
57 lines (44 loc) · 1.03 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
48
49
50
51
52
53
54
55
56
57
FROM python:3.12-alpine as build
RUN set -eux; \
pip --no-cache-dir install --no-compile build
WORKDIR /src
COPY . .
RUN set -eux; \
python3 -m build
FROM python:3.12-alpine as base
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Custom user
ARG USER=earhorn
ARG UID=1000
ARG GID=1000
RUN set -eux; \
adduser --disabled-password --uid=$UID --gecos '' --no-create-home ${USER}; \
install --directory --owner=${USER} /app
# Install ffmpeg
RUN set -eux; \
apk add --no-cache ffmpeg
# Development target
FROM base as dev
# Install earhorn
WORKDIR /src
COPY . .
RUN set -eux; \
pip --no-cache-dir install --editable .[s3,sentry]
# Run
USER ${UID}:${GID}
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/earhorn"]
# Production target
FROM base
# Install earhorn
WORKDIR /src
COPY --from=build /src/dist/*.whl .
RUN set -eux; \
export WHEEL=$(echo *.whl); \
pip --no-cache-dir install --no-compile "${WHEEL}[s3,sentry]"; \
rm -Rf /src
# Run
USER ${UID}:${GID}
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/earhorn"]