Skip to content

Commit

Permalink
Split per platform logic
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfoul committed Apr 18, 2023
1 parent 14fb3fc commit e271bbe
Show file tree
Hide file tree
Showing 132 changed files with 1,442 additions and 264 deletions.
12 changes: 12 additions & 0 deletions .automation/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ def build_dockerfile(
is_docker_build_platform_other_run = False
has_npm_copy = False
venv_builddeps_command = []
venv_builddeps_arm_command = []
venv_builddeps_amd_command = []
venv_apk_builddeps = ["gcc", "libffi-dev", "musl-dev", "make", "curl", "openssl-dev"]
# Manage docker
if requires_docker is True:
Expand Down Expand Up @@ -455,6 +457,10 @@ def build_dockerfile(
venv_apk_builddeps += item["install"]["pip_apk"]
if "pip_builddep" in item["install"]:
venv_builddeps_command += item["install"]["pip_builddep"]
if "pip_builddep_arm" in item["install"]:
venv_builddeps_arm_command += item["install"]["pip_builddep_arm"]
if "pip_builddep_amd" in item["install"]:
venv_builddeps_amd_command += item["install"]["pip_builddep_amd"]
if "build_platform_apk" in item["install"]:
apk_build_platform_packages += item["install"]["build_platform_apk"]
if "npm_apk" in item["install"]:
Expand Down Expand Up @@ -666,6 +672,12 @@ def build_dockerfile(
replace_in_file(
dockerfile, "#PIPVENV_BUILDDEPS__START", "#PIPVENV_BUILDDEPS__END", "\\n".join(venv_builddeps_command)
)
replace_in_file(
dockerfile, "#PIPVENV_BUILDDEPS_AMD__START", "#PIPVENV_BUILDDEPS_AMD__END", "\\n".join(venv_builddeps_amd_command)
)
replace_in_file(
dockerfile, "#PIPVENV_BUILDDEPS_ARM__START", "#PIPVENV_BUILDDEPS_ARM__END", "\\n".join(venv_builddeps_arm_command)
)
replace_in_file(
dockerfile, "#PIPVENV_PATH__START", "#PIPVENV_PATH__END", pipenv_path_command
)
Expand Down
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand Down Expand Up @@ -269,14 +269,22 @@ RUN apk add --update --no-cache \
openssl-dev \
g++ \
cmake
ENV CFLAGS=-mno-outline-atomics
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START
ENV CFLAGS=-mno-outline-atomics
#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
13 changes: 11 additions & 2 deletions flavors/ci_light/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand All @@ -147,7 +147,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -157,11 +156,21 @@ RUN apk add --update --no-cache \
curl \
openssl-dev
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START

#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
14 changes: 11 additions & 3 deletions flavors/cupcake/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand Down Expand Up @@ -235,7 +235,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -246,13 +245,22 @@ RUN apk add --update --no-cache \
openssl-dev \
g++ \
cmake
ENV CFLAGS=-mno-outline-atomics
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START
ENV CFLAGS=-mno-outline-atomics
#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
13 changes: 11 additions & 2 deletions flavors/documentation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand All @@ -188,7 +188,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -200,11 +199,21 @@ RUN apk add --update --no-cache \
g++ \
cmake
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START

#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
13 changes: 11 additions & 2 deletions flavors/dotnet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand All @@ -192,7 +192,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -204,11 +203,21 @@ RUN apk add --update --no-cache \
g++ \
cmake
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START

#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
13 changes: 11 additions & 2 deletions flavors/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand All @@ -195,7 +195,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -207,11 +206,21 @@ RUN apk add --update --no-cache \
g++ \
cmake
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START

#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
13 changes: 11 additions & 2 deletions flavors/java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand All @@ -188,7 +188,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -200,11 +199,21 @@ RUN apk add --update --no-cache \
g++ \
cmake
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START

#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
13 changes: 11 additions & 2 deletions flavors/javascript/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand All @@ -207,7 +207,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -219,11 +218,21 @@ RUN apk add --update --no-cache \
g++ \
cmake
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START

#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
13 changes: 11 additions & 2 deletions flavors/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ COPY --link --from=cargo /bin/* /usr/bin/
#COPY__END

FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv
FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv-base


#############################################################################################
Expand All @@ -188,7 +188,6 @@ RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv

#PIPVENV_DOWNLOAD__END

#RUN apk add --update --no-cache cmake g++
#PIPVENV_BUILDDEPS__START
RUN apk add --update --no-cache \
gcc \
Expand All @@ -200,11 +199,21 @@ RUN apk add --update --no-cache \
g++ \
cmake
#PIPVENV_BUILDDEPS__END

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable
ENV PATH=${PATH}:/root/.cargo/bin

RUN mkdir /venvs

FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-amd64
#PIPVENV_BUILDDEPS_AMD__START

#PIPVENV_BUILDDEPS_AMD__END
FROM --platform=$BUILDPLATFORM python-venv-base AS python-venv-arm64
#PIPVENV_BUILDDEPS_ARM__START

#PIPVENV_BUILDDEPS_ARM__END
FROM --platform=$BUILDPLATFORM python-venv-${TARGETPLATFORM} AS python-venv-arm64
ARG TARGETPLATFORM
COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3

Expand Down
Loading

0 comments on commit e271bbe

Please sign in to comment.