generated from giantswarm/python-app-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
53 lines (34 loc) · 1.15 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.12.6-slim AS base
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONFAULTHANDLER=1 \
ACCT_DIR="/acct"
RUN pip install --no-cache-dir -U pipenv
WORKDIR $ACCT_DIR
FROM base as builder
# pip prerequesties
RUN apt-get update && \
apt-get install --no-install-recommends -y gcc && \
apt-get clean && rm -rf /var/lib/apt/lists/*
COPY Pipfile Pipfile.lock ./
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy --clear
FROM base
ENV USE_UID=0 \
USE_GID=0 \
PATH="${ACCT_DIR}/.venv/bin:$PATH" \
PYTHONPATH=$ACCT_DIR
# install dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y sudo && \
apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder ${ACCT_DIR}/.venv ${ACCT_DIR}/.venv
COPY app_catalog_cleanup_tool/ ${ACCT_DIR}/app_catalog_cleanup_tool/
COPY container-entrypoint.sh /usr/bin
RUN chmod +x /usr/bin/container-entrypoint.sh
WORKDIR $ACCT_DIR/workdir
# we assume the user will be using UID==1000 and GID=1000; if that's not true, we'll run `chown`
# in the container's startup script
RUN chown -R 1000:1000 $ACCT_DIR
ENTRYPOINT ["container-entrypoint.sh"]
CMD ["-h"]