From 1aa5bc8d800603cad2e3196677a02dc09425a6e8 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Mon, 27 Dec 2021 09:26:06 -0600 Subject: [PATCH] pinned versions, fixed poetry, added helper scripts --- Dockerfile | 22 ++++++++++++++-------- scripts/build_container.sh | 9 +++++++++ scripts/upload_pipeline.sh | 11 +++++++++++ 3 files changed, 34 insertions(+), 8 deletions(-) create mode 100755 scripts/build_container.sh create mode 100755 scripts/upload_pipeline.sh diff --git a/Dockerfile b/Dockerfile index 461ac10..fa19841 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,12 +13,14 @@ ENV DEBIAN_FRONTEND=noninteractive RUN ln -fs /usr/share/zoneinfo/UCT /etc/localtime \ && apt-get update -y \ && apt-get install -y --fix-missing \ + build-essential=12.8ubuntu1 \ curl=7.68.0-1ubuntu2.7 \ ffmpeg=7:4.2.4-1ubuntu0.1 \ opus-tools=0.1.10-1 \ optipng=0.7.7-1 \ python3=3.8.2-0ubuntu2 \ - python3-pip=20.0.2-5ubuntu1.5 \ + python3-distutils=3.8.10-0ubuntu1~20.04 \ + python3-apt=2.0.0ubuntu0.20.04.3 \ tzdata=2021e-0ubuntu0.20.04 \ webp=0.6.1-2ubuntu0.20.04.1 @@ -26,18 +28,16 @@ WORKDIR /tmp # Install mozjpeg ARG MOZJPEG_VERSION="3.3.1" -RUN curl -LS -o mozjpeg.deb "https://nexus.nulloctet.com/repository/public/mozjpeg/mozjpeg_${MOZJPEG_VERSION}_amd64.deb" \ +ARG MOZJPEG_ARCH="amd64" +RUN curl -LS -o mozjpeg.deb "https://nexus.nulloctet.com/repository/public/mozjpeg/mozjpeg_${MOZJPEG_VERSION}_${MOZJPEG_ARCH}.deb" \ && dpkg -i mozjpeg.deb \ && ln -sf /opt/mozjpeg/bin/cjpeg /bin/cjpeg \ && rm -f mozjpeg.deb # Install poetry ARG POETRY_VERSION="1.1.12" -RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/${POETRY_VERSION}/get-poetry.py | python - - -# Cleanup image programs and cache -RUN apt-get remove -y curl \ - && rm -rf /var/lib/apt/lists/* +RUN curl -sSL "https://raw.githubusercontent.com/python-poetry/poetry/${POETRY_VERSION}/get-poetry.py" | python3 - +ENV PATH="${PATH}:/root/.poetry/bin" WORKDIR /app @@ -45,7 +45,13 @@ WORKDIR /app COPY . /app/ # Install application requirements -RUN python3 -m pip install -r requirements.txt +RUN poetry install + +# Cleanup image programs and cache +RUN apt-get remove -y \ + build-essential \ + curl \ + && rm -rf /var/lib/apt/lists/* WORKDIR /bin diff --git a/scripts/build_container.sh b/scripts/build_container.sh new file mode 100755 index 0000000..75563e2 --- /dev/null +++ b/scripts/build_container.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +TAG=${TAG:-dev} +if [[ -n "$1" ]]; then + TAG="$1" +fi + +DOCKER_BUILDKIT=1 +docker build --platform=amd64 -t sothr/acm:${TAG} . \ No newline at end of file diff --git a/scripts/upload_pipeline.sh b/scripts/upload_pipeline.sh new file mode 100755 index 0000000..3ce10de --- /dev/null +++ b/scripts/upload_pipeline.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +TEAM=docker +PIPELINE=acm + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +pushd "${DIR}" + +fly -t ${TEAM} set-pipeline --pipeline ${PIPELINE} --config pipeline.yml + +popd