forked from Mergifyio/mergify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (33 loc) · 1.02 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
### BASE ###
FROM python:3.9-slim-buster as base-image
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update -y && apt upgrade -y && apt install -y git && apt autoremove --purge -y
### BUILDER ###
FROM base-image as builder
RUN apt install -y gcc nodejs yarnpkg
RUN ln -s /usr/bin/yarnpkg /usr/bin/yarn
RUN python3 -m venv /venv
ENV VIRTUAL_ENV=/venv
ENV PATH="/venv/bin:${PATH}"
RUN python3 -m pip install wheel
# Just to be able cache a layer with all deps
ADD requirements.txt /
RUN sed -e '/^-e ./d' /requirements.txt > /constraints.txt
RUN python3 -m pip install --no-cache-dir -r /constraints.txt
# Real install that can't be cached
ADD . /app
WORKDIR /app/installer
RUN yarn
RUN yarn build
RUN rm -rf node_modules
WORKDIR /app
RUN python3 -m pip install --no-cache-dir -r ./requirements.txt
### RUNNER ###
FROM base-image as runner
RUN apt clean -y && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app /app
COPY --from=builder /venv /venv
WORKDIR /app
ENV VIRTUAL_ENV=/venv
ENV PATH="/venv/bin:${PATH}"
ENTRYPOINT ["/app/entrypoint.sh"]