forked from kapicorp/kapitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (50 loc) · 1.67 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
62
63
64
# Build the virtualenv for Kapitan
FROM python:3.8-slim AS python-builder
ARG TARGETARCH
RUN mkdir /kapitan
WORKDIR /kapitan
COPY ./kapitan ./kapitan
COPY ./MANIFEST.in ./MANIFEST.in
COPY ./requirements.txt ./requirements.txt
COPY ./pyproject.toml ./pyproject.toml
COPY ./README.md ./README.md
ENV PATH="/opt/venv/bin:${PATH}"
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
curl \
build-essential
# Install Go (for go-jsonnet)
RUN curl -fsSL -o go.tar.gz https://go.dev/dl/go1.17.3.linux-${TARGETARCH}.tar.gz \
&& tar -C /usr/local -xzf go.tar.gz \
&& rm go.tar.gz
RUN python -m venv /opt/venv \
&& pip install --upgrade pip yq wheel \
&& export PATH=$PATH:/usr/local/go/bin \
&& pip install --editable .[test] \
&& pip install .[gojsonnet]
# Install Helm
RUN 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.8-slim
COPY --from=python-builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:${PATH}"
ENV HELM_CACHE_HOME=".cache/helm"
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 \
libmagic1 \
gnupg \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --no-log-init --user-group kapitan
USER kapitan
ENTRYPOINT ["kapitan"]