Skip to content

Commit

Permalink
build: extend dockerfiles to support linux arm64 builds
Browse files Browse the repository at this point in the history
Generated a requirements file for arm64-compatible tensorflow-cpu image.
  • Loading branch information
lbarbMITRE authored and jkglasbrenner committed Sep 26, 2023
1 parent 3f49395 commit c4e199a
Show file tree
Hide file tree
Showing 11 changed files with 611 additions and 22 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pip-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ name: pip-compile runs
on:
schedule:
- cron: "10 1 * * *" # at 1:10am every day

push:
branches:
- "*"

jobs:
pip-compile:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -177,7 +180,7 @@ jobs:
- "py39-linux-aarch64-mlflow-tracking-requirements"
- "py39-linux-aarch64-restapi-requirements"
- "py39-linux-aarch64-pytorch-cpu-requirements"
# - "py39-linux-aarch64-tensorflow2-cpu-requirements"
- "py39-linux-aarch64-tensorflow2-cpu-requirements"

steps:
- uses: actions/checkout@v4
Expand Down
13 changes: 9 additions & 4 deletions docker/Dockerfile.mlflow-tracking
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@

FROM ubuntu:focal AS copy-files

ARG TARGETARCH

COPY --chown=root:root --chmod=0644 docker/configs/aws-config /files/aws-config
COPY --chown=root:root --chmod=0644 docker/configs/build.pip.conf /files/build.pip.conf
COPY --chown=root:root --chmod=0644 docker/requirements/linux-x86_64-py3.9-mlflow-tracking-requirements.txt /files/mlflow-tracking-requirements.txt
COPY --chown=root:root --chmod=0644 docker/requirements/linux-${TARGETARCH}-py3.9-mlflow-tracking-requirements.txt /files/mlflow-tracking-requirements.txt

######################################################################################################
# Base images
Expand Down Expand Up @@ -148,13 +150,16 @@ RUN mkdir -p /shellscripts && \

FROM certs-base AS install-awscli

ARG AWSCLI_DOWNLOAD_URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
ARG TARGETARCH
ARG AWSCLI_DOWNLOAD_BASE_URL=https://awscli.amazonaws.com
ARG AWSCLI_INSTALL_DIR=/opt/aws-cli
ARG AWSCLI_BIN_DIR=/usr/local/bin

SHELL ["/bin/bash", "-c"]

RUN cd /tmp && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_URL} && \
unzip awscliv2.zip && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_BASE_URL}/awscli-exe-linux-${TARGETARCH/arm/aarch}.zip && \
unzip /tmp/awscliv2.zip && \
rm /tmp/awscliv2.zip && \
./aws/install --install-dir ${AWSCLI_INSTALL_DIR} --bin-dir ${AWSCLI_BIN_DIR} && \
rm -rf /tmp/aws
Expand Down
13 changes: 9 additions & 4 deletions docker/Dockerfile.pytorch-cpu
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@

FROM ubuntu:focal AS copy-files

ARG TARGETARCH

COPY --chown=root:root --chmod=0644 docker/configs/aws-config /files/aws-config
COPY --chown=root:root --chmod=0644 docker/configs/build.pip.conf /files/build.pip.conf
COPY --chown=root:root --chmod=0644 docker/requirements/linux-x86_64-py3.9-pytorch-cpu-requirements.txt /files/pytorch-cpu-requirements.txt
COPY --chown=root:root --chmod=0644 docker/requirements/linux-${TARGETARCH}-py3.9-pytorch-cpu-requirements.txt /files/pytorch-cpu-requirements.txt

######################################################################################################
# Base images
Expand Down Expand Up @@ -160,13 +162,16 @@ RUN mkdir -p /shellscripts && \

FROM certs-base AS install-awscli

ARG AWSCLI_DOWNLOAD_URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
ARG TARGETARCH
ARG AWSCLI_DOWNLOAD_BASE_URL=https://awscli.amazonaws.com
ARG AWSCLI_INSTALL_DIR=/opt/aws-cli
ARG AWSCLI_BIN_DIR=/usr/local/bin

SHELL ["/bin/bash", "-c"]

RUN cd /tmp && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_URL} && \
unzip awscliv2.zip && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_BASE_URL}/awscli-exe-linux-${TARGETARCH/arm/aarch}.zip && \
unzip /tmp/awscliv2.zip && \
rm /tmp/awscliv2.zip && \
./aws/install --install-dir ${AWSCLI_INSTALL_DIR} --bin-dir ${AWSCLI_BIN_DIR} && \
rm -rf /tmp/aws
Expand Down
13 changes: 9 additions & 4 deletions docker/Dockerfile.restapi
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@

FROM ubuntu:focal AS copy-files

ARG TARGETARCH

COPY --chown=root:root src/migrations /files/migrations
COPY --chown=root:root --chmod=0644 docker/configs/aws-config /files/aws-config
COPY --chown=root:root --chmod=0644 docker/configs/build.pip.conf /files/build.pip.conf
COPY --chown=root:root --chmod=0644 docker/configs/gunicorn.restapi.conf.py /files/gunicorn.restapi.conf.py
COPY --chown=root:root --chmod=0644 docker/requirements/linux-x86_64-py3.9-restapi-requirements.txt /files/restapi-requirements.txt
COPY --chown=root:root --chmod=0644 docker/requirements/linux-${TARGETARCH}-py3.9-restapi-requirements.txt /files/restapi-requirements.txt
COPY --chown=root:root --chmod=0755 wsgi.py /files/wsgi.py

RUN chmod 0755 /files/migrations && \
Expand Down Expand Up @@ -164,13 +166,16 @@ RUN mkdir -p /shellscripts && \

FROM certs-base AS install-awscli

ARG AWSCLI_DOWNLOAD_URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
ARG TARGETARCH
ARG AWSCLI_DOWNLOAD_BASE_URL=https://awscli.amazonaws.com
ARG AWSCLI_INSTALL_DIR=/opt/aws-cli
ARG AWSCLI_BIN_DIR=/usr/local/bin

SHELL ["/bin/bash", "-c"]

RUN cd /tmp && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_URL} && \
unzip awscliv2.zip && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_BASE_URL}/awscli-exe-linux-${TARGETARCH/arm/aarch}.zip && \
unzip /tmp/awscliv2.zip && \
rm /tmp/awscliv2.zip && \
./aws/install --install-dir ${AWSCLI_INSTALL_DIR} --bin-dir ${AWSCLI_BIN_DIR} && \
rm -rf /tmp/aws
Expand Down
13 changes: 9 additions & 4 deletions docker/Dockerfile.tensorflow2-cpu
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@

FROM ubuntu:focal AS copy-files

ARG TARGETARCH

COPY --chown=root:root --chmod=0644 docker/configs/aws-config /files/aws-config
COPY --chown=root:root --chmod=0644 docker/configs/build.pip.conf /files/build.pip.conf
COPY --chown=root:root --chmod=0644 docker/requirements/linux-x86_64-py3.9-tensorflow2-cpu-requirements.txt /files/tensorflow2-cpu-requirements.txt
COPY --chown=root:root --chmod=0644 docker/requirements/linux-${TARGETARCH}-py3.9-tensorflow2-cpu-requirements.txt /files/tensorflow2-cpu-requirements.txt

######################################################################################################
# Base images
Expand Down Expand Up @@ -160,13 +162,16 @@ RUN mkdir -p /shellscripts && \

FROM certs-base AS install-awscli

ARG AWSCLI_DOWNLOAD_URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
ARG TARGETARCH
ARG AWSCLI_DOWNLOAD_BASE_URL=https://awscli.amazonaws.com
ARG AWSCLI_INSTALL_DIR=/opt/aws-cli
ARG AWSCLI_BIN_DIR=/usr/local/bin

SHELL ["/bin/bash", "-c"]

RUN cd /tmp && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_URL} && \
unzip awscliv2.zip && \
wget -qO /tmp/awscliv2.zip ${AWSCLI_DOWNLOAD_BASE_URL}/awscli-exe-linux-${TARGETARCH/arm/aarch}.zip && \
unzip /tmp/awscliv2.zip && \
rm /tmp/awscliv2.zip && \
./aws/install --install-dir ${AWSCLI_INSTALL_DIR} --bin-dir ${AWSCLI_BIN_DIR} && \
rm -rf /tmp/aws
Expand Down
Loading

0 comments on commit c4e199a

Please sign in to comment.