Merge pull request #335 from pinry/feature/add-multi-platoform-build

feature: try to add docker build for docker buildx close #333
This commit is contained in:
Ji Qu
2022-04-21 23:45:57 +08:00
committed by GitHub
3 changed files with 31 additions and 2 deletions

View File

@@ -22,14 +22,17 @@ RUN yarn build
# Required for other database options
FROM python:3.9.12-slim-buster as base
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& if [ $(dpkg --print-architecture) = "arm64" -o $(dpkg --print-architecture) = "armhf" ]; then apt-get -y install apt-utils; fi \
&& apt-get -y install gcc default-libmysqlclient-dev
RUN pip --no-cache-dir install --user mysqlclient cx-Oracle
# Final image
FROM python:3.9.12-slim-buster
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR pinry
RUN mkdir /data && chown -R www-data:www-data /data
@@ -48,7 +51,7 @@ RUN apt-get update \
# Install Pillow dependencies
&& apt-get -y install libopenjp2-7 libjpeg-turbo-progs libjpeg62-turbo-dev libtiff5-dev libxcb1 \
# Needed to compile psycopg2 on arm (fallback for psycopg2-binary)
&& if [ $(dpkg --print-architecture) = "arm64" -o $(dpkg --print-architecture) = "armhf" ]; then apt-get -y install libpq-dev gcc; fi \
&& if [ $(dpkg --print-architecture) = "arm64" -o $(dpkg --print-architecture) = "armhf" ]; then apt-get -y install apt-utils libpq-dev gcc; fi \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoclean

View File

@@ -1,4 +1,12 @@
#!/bin/bash
script_dir="$( dirname "${0}" )"
sudo docker build -t getpinry/pinry${@} "${script_dir}/../" -f "${script_dir}/../Dockerfile.autobuild"
IMAGE_LATEST_TAG="latest"
IMAGE_VERSION_TAG=`git tag -l --sort=-creatordate | head -n 1 | sed "s/v//g"`
sudo docker build -t getpinry/pinry:${IMAGE_LATEST_TAG} "${script_dir}/../" \
-f "${script_dir}/../Dockerfile.autobuild"
sudo docker build -t getpinry/pinry:${IMAGE_VERSION_TAG} "${script_dir}/../" \
-f "${script_dir}/../Dockerfile.autobuild"

View File

@@ -0,0 +1,18 @@
#!/bin/bash
script_dir="$( dirname "${0}" )"
IMAGE_LATEST_TAG="latest"
IMAGE_VERSION_TAG=`git tag -l --sort=-creatordate | head -n 1 | sed "s/v//g"`
sudo docker buildx build \
--push \
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
-t getpinry/pinry:${IMAGE_LATEST_TAG} "${script_dir}/../" \
-f "${script_dir}/../Dockerfile.autobuild"
sudo docker buildx build \
--push \
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
-t getpinry/pinry:${IMAGE_VERSION_TAG} "${script_dir}/../" \
-f "${script_dir}/../Dockerfile.autobuild"