Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image building improvements #292

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ on:
- '*'
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'

env:
DOCKERHUB_SLUG: crazymax/rtorrent-rutorrent
Expand Down
111 changes: 111 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: pull

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths-ignore:
- '**.md'

jobs:
build_amd64:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make some changes to distribute builds across runners. I already done this in https://github.com/crazy-max/docker-linguist/blob/master/.github/workflows/build.yml based on a guide I made: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners

I keep you posted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I will submit a new pull request in 15 minutes!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged #293 and opened #294 as follow-up to fix some issues.

runs-on: ubuntu-latest
timeout-minutes: 20
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-amd64

build_arm64:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-arm64

build_arm_v6:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-arm-v6

build_arm_v7:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-arm-v7
25 changes: 10 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ RUN apk --update --no-cache add \
brotli-dev \
build-base \
cppunit-dev \
cmake \
gd-dev \
geoip-dev \
libtool \
Expand Down Expand Up @@ -110,22 +111,16 @@ RUN tree ${DIST_PATH}

WORKDIR /usr/local/src/cares
COPY --from=src-cares /src .
RUN ./configure
RUN make -j$(nproc) CFLAGS="-O2 -flto"
RUN cmake . -D CARES_SHARED=ON -D CMAKE_BUILD_TYPE:STRING="Release" -D CMAKE_C_FLAGS_RELEASE:STRING="-O2 -pipe -flto=\"$(nproc)\""
RUN cmake --build . --clean-first --parallel $(nproc)
RUN make install -j$(nproc)
RUN make DESTDIR=${DIST_PATH} install -j$(nproc)
RUN tree ${DIST_PATH}

WORKDIR /usr/local/src/curl
COPY --from=src-curl /src .
RUN ./configure \
--enable-ares \
--enable-tls-srp \
--enable-gnu-tls \
--with-brotli \
--with-ssl \
--with-zlib
RUN make -j$(nproc) CFLAGS="-O2 -flto -pipe"
RUN cmake . -D ENABLE_ARES=ON -D CURL_LTO=ON -D CURL_USE_OPENSSL=ON -D CURL_BROTLI=ON -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE:STRING="Release" -D CMAKE_C_FLAGS_RELEASE:STRING="-O2 -pipe -flto=\"$(nproc)\""
RUN cmake --build . --clean-first --parallel $(nproc)
RUN make install -j$(nproc)
RUN make DESTDIR=${DIST_PATH} install -j$(nproc)
RUN tree ${DIST_PATH}
Expand All @@ -135,8 +130,8 @@ COPY --from=src-xmlrpc /src .
RUN ./configure \
--disable-wininet-client \
--disable-libwww-client
RUN make -j$(nproc)
RUN make install -j$(nproc) CXXFLAGS="-flto"
RUN make -j$(nproc) CFLAGS="-w -O3 -flto" CXXFLAGS="-w -O3 -flto"
RUN make install -j$(nproc)
RUN make DESTDIR=${DIST_PATH} install -j$(nproc)
RUN tree ${DIST_PATH}

Expand All @@ -147,8 +142,8 @@ RUN patch -p1 < throttle-fix-0.13.8.patch
RUN ./autogen.sh
RUN ./configure \
--with-posix-fallocate
RUN make -j$(nproc)
RUN make install -j$(nproc) CXXFLAGS="-O2 -flto"
RUN make -j$(nproc) CXXFLAGS="-w -O2 -flto"
RUN make install -j$(nproc)
RUN make DESTDIR=${DIST_PATH} install -j$(nproc)
RUN tree ${DIST_PATH}

Expand All @@ -165,7 +160,7 @@ RUN ./autogen.sh
RUN ./configure \
--with-xmlrpc-c \
--with-ncurses
RUN make -j$(nproc) CXXFLAGS="-O2 -flto"
RUN make -j$(nproc) CXXFLAGS="-w -O2 -flto"
RUN make install -j$(nproc)
RUN make DESTDIR=${DIST_PATH} install -j$(nproc)
RUN tree ${DIST_PATH}
Expand Down
28 changes: 28 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,31 @@ target "image-all" {
"linux/arm64"
]
}

target "image-amd64" {
inherits = ["image"]
platforms = [
"linux/amd64"
]
}

target "image-arm64" {
inherits = ["image"]
platforms = [
"linux/arm64"
]
}

target "image-arm-v6" {
inherits = ["image"]
platforms = [
"linux/arm/v6"
]
}

target "image-arm-v7" {
inherits = ["image"]
platforms = [
"linux/arm/v7"
]
}