-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
38 lines (30 loc) · 1.1 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
### Builder image
FROM ubuntu:latest AS deps
# install python
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --no-install-recommends -y python3.12 python3.12-dev python3.12-venv python3-pip python3-wheel build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# create and activate virtual environment
RUN python3.12 -m venv /root/venv
ENV PATH="/root/venv/bin:$PATH"
# install requirements
COPY requirements.txt .
RUN pip install -r requirements.txt
### Runner image
FROM ubuntu:latest AS runner-image
# install python
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --no-install-recommends -y python3.12 python3.12-venv && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# setup app directory
RUN mkdir -p /run
WORKDIR /run
COPY . .
COPY config.json.template /config/config.json
RUN mkdir -p /state
COPY --from=deps /root/venv /root/venv
# prepare runtime environment
USER root
ENV VIRTUAL_ENV=/root/venv
ENV PATH="/root/venv/bin:$PATH"
ENTRYPOINT ["python", "-u", "./respotter.py", "-c", "/config/config.json", "--state-file", "/state/state.json"]