|
1 | 1 | # Using Python original Docker image |
2 | | -FROM --platform=linux/amd64 python:3.9-alpine |
| 2 | +ARG BUILDPLATFORM=linux/amd64 |
| 3 | +FROM --platform=$BUILDPLATFORM python:3.9-alpine |
3 | 4 |
|
4 | | -# Install necessary packages |
5 | | -RUN apk add \ |
6 | | - git \ |
7 | | - curl \ |
8 | | - jq \ |
9 | | - build-base \ |
10 | | - libffi-dev |
11 | 5 |
|
12 | | -RUN curl https://sh.rustup.rs -sSf -o rustup.sh ; chmod +x rustup.sh ; ./rustup.sh -y |
13 | | -ENV PATH="$PATH:/root/.cargo/bin" |
14 | | - |
15 | | -# Install spire-agent |
16 | | -RUN wget -q https://github.com/spiffe/spire/releases/download/v1.9.1/spire-1.9.1-linux-amd64-musl.tar.gz |
17 | | -RUN tar xvf spire-1.9.1-linux-amd64-musl.tar.gz ; mv spire-1.9.1 /opt ; mv /opt/spire-1.9.1 /opt/spire |
18 | | -RUN ln -s /opt/spire/bin/spire-agent /usr/bin/spire-agent |
19 | 6 |
|
20 | | -# Install pyspiffe package |
21 | | -RUN pip install git+https://github.com/HewlettPackard/py-spiffe.git@3640af9d6629c05e027f99010abc934cb74122a8 |
| 7 | +# Add rust binaries to PATH |
| 8 | +ENV PATH="$PATH:/root/.cargo/bin" |
22 | 9 |
|
23 | 10 | # Create code directory, output directory |
24 | | -RUN mkdir /container_preparation /output ; chmod -R 777 /output |
| 11 | +RUN mkdir /container_preparation /output |
25 | 12 |
|
26 | 13 | # Copy useful data from the project |
27 | 14 | COPY ./client/container_preparation /container_preparation |
28 | 15 |
|
29 | | -# Install dependencies |
30 | | -RUN cd /container_preparation && pip install -r ./requirements.txt |
31 | | - |
32 | 16 | # Copy utils for SPIFFEID creation ... |
33 | 17 | COPY ./utils /container_preparation/utils |
34 | 18 |
|
35 | 19 | # Set workdir |
36 | 20 | WORKDIR /container_preparation |
37 | 21 |
|
| 22 | +# Install necessary packages, spire-agent and rust |
| 23 | +RUN apk add --no-cache \ |
| 24 | + git=2.43.0-r0 \ |
| 25 | + curl=8.5.0-r0 \ |
| 26 | + jq=1.7.1-r0 \ |
| 27 | + build-base=0.5-r3 \ |
| 28 | + libffi-dev=3.4.4-r3 && \ |
| 29 | +curl -LsSf -o spire-1.9.0-linux-amd64-musl.tar.gz https://github.com/spiffe/spire/releases/download/v1.9.0/spire-1.9.0-linux-amd64-musl.tar.gz && \ |
| 30 | +tar xvf spire-1.9.0-linux-amd64-musl.tar.gz ; mv spire-1.9.0 /opt ; mv /opt/spire-1.9.0 /opt/spire && \ |
| 31 | +ln -s /opt/spire/bin/spire-agent /usr/bin/spire-agent && \ |
| 32 | +ln -s /opt/spire/bin/spire-server /usr/bin/spire-server && \ |
| 33 | +rm -rf spire-1.9.0-linux-amd64-musl.tar.gz && \ |
| 34 | +curl https://sh.rustup.rs -sSf -o rustup.sh ; chmod +x rustup.sh ; ./rustup.sh -y ; export PATH="$PATH":/root/.cargo/bin && \ |
| 35 | +pip install --no-cache-dir -r ./requirements.txt && \ |
| 36 | +pip install --no-cache-dir git+https://github.com/HewlettPackard/py-spiffe.git@3640af9d6629c05e027f99010abc934cb74122a8 && \ |
| 37 | +rm -r /root/.cargo /root/.rustup |
| 38 | + |
38 | 39 | # Set entrypoint |
39 | 40 | ENTRYPOINT [ "./entrypoint.sh" ] |
0 commit comments