forked from kapicorp/kapitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (46 loc) · 1.62 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
# First build the Helm binding
FROM golang:1.14.4-stretch AS helm-builder
RUN mkdir /kapitan
WORKDIR /kapitan
COPY ./kapitan/inputs/helm ./kapitan/inputs/helm
RUN chmod +x ./kapitan/inputs/helm/build.sh \
&& ./kapitan/inputs/helm/build.sh
COPY ./kapitan/dependency_manager/helm ./kapitan/dependency_manager/helm
RUN chmod +x ./kapitan/dependency_manager/helm/build.sh \
&& ./kapitan/dependency_manager/helm/build.sh
COPY ./kapitan ./kapitan
COPY ./MANIFEST.in ./MANIFEST.in
COPY ./requirements.txt ./requirements.txt
COPY ./setup.py ./setup.py
# Build the virtualenv for Kapitan
FROM python:3.7-slim-stretch AS python-builder
COPY --from=helm-builder /kapitan /kapitan
WORKDIR /kapitan
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 \
&& ./kapitan/inputs/helm/build.sh \
&& ./kapitan/dependency_manager/helm/build.sh \
&& pip install .
# 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"]