-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (39 loc) · 1.07 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
FROM python:3.8-slim-buster as base
ARG USER=thoth_issue_predictor
ARG UID=1000
ARG GID=1000
ARG WORKDIR="/opt/$USER"
ARG LOCALBIN="/home/$USER/.local/bin"
ARG PIPENV="/home/$USER/.pipenv/bin"
ARG VCS_URL="https://gitlab.ictmedia.cz/device-security/cloud/network_checker.git"
ARG BUILD_DATE
ARG VCS_BRANCH
ARG VCS_REF
LABEL image.build-date=$BUILD_DATE\
image.name=$USER\
project.vcs-url=$VCS_URL\
project.version="0.1.0"\
project.vcs-branch=$VCS_BRANCH\
project.vcs_ref=$VCS_REF
ENV PYTHONUNBUFFERED 1
ENV PATH=$PATH:$LOCALBIN:$PIPENV
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y \
libpq-dev \
gcc \
git \
curl \
pipenv \
graphviz \
&& groupadd -g $GID $USER \
&& useradd -m -u $UID -g $GID -s /bin/bash $USER \
&& install -d -m 0755 -o $USER -g $USER $WORKDIR
FROM base as poetry
USER $USER
SHELL ["/bin/bash", "-c"]
RUN mkdir -p -m 700 "$HOME/.ssh/"
FROM poetry as deployment
WORKDIR $WORKDIR
COPY --chown=$USER . $WORKDIR
RUN --mount=type=ssh,uid=1000 pipenv install
ENTRYPOINT ["pipenv", "run"]