-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (31 loc) · 1.09 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
FROM python:3.10-slim as build
ENV workdir=/app
RUN mkdir -p $workdir
WORKDIR $workdir
RUN apt-get update
RUN apt-get install -y openssl ca-certificates
RUN apt-get install -y libffi-dev build-essential libssl-dev git rustc cargo xvfb wkhtmltopdf
RUN pip install pip -U
RUN pip install poetry -U
RUN ln -s $workdir/wkhtmltopdf.sh /bin/wkhtmltopdf
# Install dependencies first
COPY poetry.lock pyproject.toml $workdir
RUN poetry install --no-root --no-dev
RUN apt-get remove --purge -y libffi-dev build-essential libssl-dev git rustc cargo
RUN rm -rf /root/.cargo
# Copy source code as late as possible to take advantages about layer cache
COPY . $workdir
RUN poetry install --no-dev
# Squash layers
# FROM python:3.10-slim
# COPY --from=build / / # doesn't work on kaniko
# Waiting for: https://github.com/GoogleContainerTools/kaniko/pull/1724
# ENV workdir=/app
# COPY --from=build /usr /usr
# COPY --from=build /home /home
# COPY --from=build /opt /opt
# COPY --from=build /lib /lib
# COPY --from=build /app /app
# WORKDIR /app
ENV PROMETHEUS_MULTIPROC_DIR=/tmp/gmail2s3/prometheus
CMD ["./run-server.sh"]