forked from cloud-custodian/cloud-custodian
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc7n
More file actions
109 lines (77 loc) · 4.27 KB
/
Copy pathc7n
File metadata and controls
109 lines (77 loc) · 4.27 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Dockerfiles are generated from tools/dev/dockerpkg.py
FROM ubuntu:24.04 AS build-env
SHELL ["/bin/bash", "-c"]
# pre-requisite distro deps, and build env setup
RUN apt-get --yes update
RUN apt-get --yes install --no-install-recommends build-essential curl python3-venv python3-dev adduser
RUN adduser --disabled-login --gecos "" custodian
# wheel installation cache
RUN --mount=type=cache,target=/root/.cache/uv
COPY --from=ghcr.io/astral-sh/uv:0.7.6 /uv /uvx /bin/
ARG PATH="/root/.local/bin:$PATH"
WORKDIR /src
# Add core & aws packages
ARG providers="gcp azure kube openstack tencentcloud oci awscc"
# copy pyproject.tomls for all packages
ADD pyproject.toml uv.lock README.md /src/
RUN uv sync --frozen --inexact --no-install-workspace
# We include `pyproject.toml` and `uv.lock` first to allow
# cache of dependency installs.
ADD tools/c7n_gcp/pyproject.toml /src/tools/c7n_gcp/
RUN if [[ " ${providers[*]} " =~ "gcp" ]]; then uv sync --package c7n_gcp --frozen --inexact --no-install-workspace; fi
ADD tools/c7n_azure/pyproject.toml /src/tools/c7n_azure/
RUN if [[ " ${providers[*]} " =~ "azure" ]]; then uv sync --package c7n_azure --frozen --inexact --no-install-workspace; fi
ADD tools/c7n_kube/pyproject.toml /src/tools/c7n_kube/
RUN if [[ " ${providers[*]} " =~ "kube" ]]; then uv sync --package c7n_kube --frozen --inexact --no-install-workspace; fi
ADD tools/c7n_openstack/pyproject.toml /src/tools/c7n_openstack/
RUN if [[ " ${providers[*]} " =~ "openstack" ]]; then uv sync --package c7n_openstack --frozen --inexact --no-install-workspace; fi
ADD tools/c7n_tencentcloud/pyproject.toml /src/tools/c7n_tencentcloud/
RUN if [[ " ${providers[*]} " =~ "tencentcloud" ]]; then uv sync --package c7n_tencentcloud --frozen --inexact --no-install-workspace; fi
ADD tools/c7n_oci/pyproject.toml /src/tools/c7n_oci/
RUN if [[ " ${providers[*]} " =~ "oci" ]]; then uv sync --package c7n_oci --frozen --inexact --no-install-workspace; fi
ADD tools/c7n_awscc/pyproject.toml /src/tools/c7n_awscc/
RUN if [[ " ${providers[*]} " =~ "awscc" ]]; then uv sync --package c7n_awscc --frozen --inexact --no-install-workspace; fi
# copy packages
ADD c7n /src/c7n/
RUN uv sync --frozen --inexact
# Now install the root of each provider
ADD tools/c7n_gcp /src/tools/c7n_gcp
RUN if [[ " ${providers[*]} " =~ "gcp" ]]; then uv sync --package c7n_gcp --frozen --inexact; fi
ADD tools/c7n_azure /src/tools/c7n_azure
RUN if [[ " ${providers[*]} " =~ "azure" ]]; then uv sync --package c7n_azure --frozen --inexact; fi
ADD tools/c7n_kube /src/tools/c7n_kube
RUN if [[ " ${providers[*]} " =~ "kube" ]]; then uv sync --package c7n_kube --frozen --inexact; fi
ADD tools/c7n_openstack /src/tools/c7n_openstack
RUN if [[ " ${providers[*]} " =~ "openstack" ]]; then uv sync --package c7n_openstack --frozen --inexact; fi
ADD tools/c7n_tencentcloud /src/tools/c7n_tencentcloud
RUN if [[ " ${providers[*]} " =~ "tencentcloud" ]]; then uv sync --package c7n_tencentcloud --frozen --inexact; fi
ADD tools/c7n_oci /src/tools/c7n_oci
RUN if [[ " ${providers[*]} " =~ "oci" ]]; then uv sync --package c7n_oci --frozen --inexact; fi
ADD tools/c7n_awscc /src/tools/c7n_awscc
RUN if [[ " ${providers[*]} " =~ "awscc" ]]; then uv sync --package c7n_awscc --frozen --inexact; fi
RUN mkdir /output
FROM ubuntu:24.04
LABEL name="cli" \
repository="http://github.com/cloud-custodian/cloud-custodian"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get --yes update \
&& apt-get --yes install python3 python3-venv adduser --no-install-recommends \
&& rm -Rf /var/cache/apt \
&& rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /var/log/*
# These should remain below any other commands because they will invalidate
# the layer cache
COPY --from=build-env /src /src
COPY --from=build-env /usr/local /usr/local
COPY --from=build-env /output /output
RUN adduser --disabled-login --gecos "" custodian
RUN ln -s /src/.venv/bin/custodian /usr/local/bin/custodian
USER custodian
WORKDIR /home/custodian
ENV LC_ALL="C.UTF-8" LANG="C.UTF-8"
VOLUME ["/home/custodian"]
ENTRYPOINT ["/usr/local/bin/custodian"]
CMD ["--help"]
LABEL "org.opencontainers.image.title"="cli"
LABEL "org.opencontainers.image.description"="Cloud Management Rules Engine"
LABEL "org.opencontainers.image.documentation"="https://cloudcustodian.io/docs"