Skip to content

Commit

Permalink
fix: arm images push
Browse files Browse the repository at this point in the history
  • Loading branch information
bayang committed Jan 18, 2022
1 parent dd8a1c7 commit 02c6ee0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 57 deletions.
42 changes: 27 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ FROM eclipse-temurin:11.0.13_8-jre-focal

WORKDIR app

ARG TARGETPLATFORM
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}

ARG DEPENDENCY=build/dependency
COPY ${DEPENDENCY}/dependencies/ ./
COPY ${DEPENDENCY}/spring-boot-loader/ ./
Expand All @@ -13,21 +16,30 @@ ENV JELU_FILES_DIR="/files/"
ENV JELU_METADATA_CALIBRE_PATH="/calibre/fetch-ebook-metadata"
ENV LC_ALL=en_US.UTF-8

RUN apt-get update && apt-get install --no-install-recommends --yes wget xz-utils \
xdg-utils \
libxcb-xinerama0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-randr0 \
qt5-default \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sh /dev/stdin install_dir=/ isolated=y \
&& curl https://www.mobileread.com/forums/attachment.php\?attachmentid\=182200\&d\=1641360812 > goodreads.zip \
&& /calibre/calibre-customize --add-plugin goodreads.zip \
&& rm goodreads.zip
RUN echo target platform $TARGETPLATFORM

RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
apt-get update && apt-get install --no-install-recommends --yes wget xz-utils \
xdg-utils \
libxcb-xinerama0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-randr0 \
qt5-default \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sh /dev/stdin install_dir=/ isolated=y \
&& curl https://www.mobileread.com/forums/attachment.php\?attachmentid\=182200\&d\=1641360812 > goodreads.zip \
&& /calibre/calibre-customize --add-plugin goodreads.zip \
&& rm goodreads.zip; \
else \
apt-get update && apt-get install --no-install-recommends --yes calibre \
&& curl https://www.mobileread.com/forums/attachment.php\?attachmentid\=182200\&d\=1641360812 > goodreads.zip \
&& calibre-customize --add-plugin goodreads.zip \
&& rm goodreads.zip; \
fi

ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=optional:file:/config/"]
EXPOSE 11111
22 changes: 0 additions & 22 deletions Dockerfile-arm

This file was deleted.

4 changes: 1 addition & 3 deletions ci/docker-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
# 2: channel

export DOCKER_CLI_EXPERIMENTAL=enabled
PLATFORMS=linux/amd64

ARM_PLATFORMS=linux/arm/v7,linux/arm64/v8
PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64/v8

if [ -z "$2" ]; then
DOCKER_CHANNEL="latest"
Expand Down
8 changes: 0 additions & 8 deletions ci/prepare-dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,3 @@ docker buildx build \
--tag wabayang/jelu:$DOCKER_CHANNEL \
--tag wabayang/jelu:$1 \
--file ./Dockerfile .

# build arm
docker buildx build \
--platform $ARM_PLATFORMS \
--cache-from wabayang/jelu:$DOCKER_CHANNEL \
--tag wabayang/jelu:$DOCKER_CHANNEL \
--tag wabayang/jelu:$1 \
--file ./Dockerfile-arm .
10 changes: 1 addition & 9 deletions ci/publish-dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,8 @@ source "$(dirname "$0")/docker-common.sh" $1 $2
# Push docker images (built previously)
docker buildx build \
--platform $PLATFORMS \
--tag wabayang/jelu:$DOCKER_CHANNEL \
--tag wabayang/jelu:$1 \
--file ./Dockerfile . \
--push

# push arm images
docker buildx build \
--platform $ARM_PLATFORMS \
--cache-from wabayang/jelu:$DOCKER_CHANNEL \
--tag wabayang/jelu:$DOCKER_CHANNEL \
--tag wabayang/jelu:$1 \
--file ./Dockerfile-arm . \
--file ./Dockerfile . \
--push

0 comments on commit 02c6ee0

Please sign in to comment.