forked from kapicorp/kapitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (40 loc) · 1.37 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
# Build the virtualenv for Kapitan
FROM python:3.7-slim-stretch AS python-builder
RUN mkdir /kapitan
WORKDIR /kapitan
COPY ./kapitan ./kapitan
COPY ./MANIFEST.in ./MANIFEST.in
COPY ./requirements.txt ./requirements.txt
COPY ./setup.py ./setup.py
ENV PATH="/opt/venv/bin:${PATH}"
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
&& python -m venv /opt/venv \
&& pip install --upgrade pip yq wheel \
&& pip install -r requirements.txt \
&& pip install .
# Install Helm
RUN apt-get install --no-install-recommends -y curl \
&& curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 \
&& chmod 700 get_helm.sh \
&& HELM_INSTALL_DIR=/opt/venv/bin ./get_helm.sh --no-sudo \
&& rm get_helm.sh
# Final image with virtualenv built in previous step
FROM python:3.7-slim-stretch
COPY --from=python-builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:${PATH}"
ENV SEARCHPATH="/src"
VOLUME ${SEARCHPATH}
WORKDIR ${SEARCHPATH}
# Install runtime dependencies and run as a non-root user for good measure
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
git \
ssh-client \
gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --no-log-init --user-group kapitan
USER kapitan
ENTRYPOINT ["kapitan"]