-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (44 loc) · 1.7 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
58
59
60
61
#################################################################
####################### BUILD STAGE #############################
#################################################################
FROM snakepacker/python:all as builder
ARG GIT_BRANCH
ARG GITHUB_SHA
ARG DEV_MODE=false
ENV GIT_BRANCH=$GIT_BRANCH
ENV GITHUB_SHA=$GITHUB_SHA
ENV PIPENV_DEV=$DEV_MODE
RUN python3.10 -m venv /usr/share/python3/app
# Setup python env
COPY ./pipfiles/ /etc/pipfiles/
WORKDIR /etc/pipfiles/
RUN /usr/share/python3/app/bin/pip install -U pip setuptools wheel && \
/usr/share/python3/app/bin/pip install --no-cache-dir pipenv==2022.4.30 && \
/usr/share/python3/app/bin/pipenv install --system --ignore-pipfile && \
/usr/share/python3/app/bin/python3.10 -m spacy download ru_core_news_sm
RUN find-libdeps /usr/share/python3/app > /usr/share/python3/app/pkgdeps.txt
#################################################################
####################### TARGET STAGE ############################
#################################################################
FROM snakepacker/python:3.10
ARG GIT_BRANCH
ARG GITHUB_SHA
ARG DEV_MODE=false
ARG USER=app
ARG APP_NAME=naive_feedya
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV GIT_BRANCH=$GIT_BRANCH
ENV GITHUB_SHA=$GITHUB_SHA
ENV DEV_MODE=$DEV_MODE
COPY --from=builder /usr/share/python3/app /usr/share/python3/app
RUN cat /usr/share/python3/app/pkgdeps.txt | xargs apt-install
COPY ./app/ /home/$USER/app/
COPY ./cache/ /var/lib/naive_feedya/
# Setup app env and create cache folder
RUN useradd -U -s /bin/bash $USER && \
chown -R $USER:$USER /home/$USER/ && \
chown -R $USER:$USER /var/lib/$APP_NAME
WORKDIR /home/$USER/app
USER $USER
EXPOSE 8008