Skip to content

Commit

Permalink
Merge pull request #564 from sebadob/rework-builder-image
Browse files Browse the repository at this point in the history
Rework builder image
  • Loading branch information
sebadob authored Sep 23, 2024
2 parents 8bcda90 + b93c19b commit 54bc517
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 29 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["src/*"]
exclude = ["rauthy-client"]

[workspace.package]
version = "0.26.0-beta2"
version = "0.26.0-beta3"
edition = "2021"
authors = ["Sebastian Dobe <[email protected]>"]
license = "Apache-2.0"
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile_builder
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig
ENV LD_LIBRARY_PATH="${PATH}:/usr/local/lib64"
ENV PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig"

ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc

RUN <<EOF
#!/bin/bash
set -e

rustup target add aarch64-unknown-linux-gnu

apt update
apt install -y gcc-aarch64-linux-gnu
apt-get clean
EOF

COPY --from=openssl /etc/ld.so.conf.d/lib64.conf /etc/ld.so.conf.d/lib64.conf
COPY --from=openssl /usr/local/lib64 /usr/local/lib64
COPY --from=openssl /usr/local/include/openssl /usr/local/include/openssl
Expand Down
69 changes: 69 additions & 0 deletions Dockerfile_builder_openssl_manual
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
ARG IMAGE

FROM $IMAGE AS openssl

ENV LD_LIBRARY_PATH="${PATH}:/usr/local/lib64"
ENV PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig"
ENV MAKEFLAGS="-j32"

WORKDIR /root

RUN <<EOF
set -e

apt update
apt install -y build-essential checkinstall curl zlib1g-dev vim
rm -rf /var/lib/apt/lists/*

curl -LO https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz
tar xvf openssl-3.3.2.tar.gz

cd openssl-3.3.2
./config
make
make test
make install
echo '/usr/local/lib64' > /etc/ld.so.conf.d/lib64.conf
ldconfig

cd ..
rm -rf openssl*
EOF

############################################
############################################

FROM $IMAGE

ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig
ENV LD_LIBRARY_PATH="${PATH}:/usr/local/lib64"
ENV PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig"

ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc

RUN <<EOF
#!/bin/bash
set -e

rustup target add aarch64-unknown-linux-gnu

apt update
apt install -y gcc-aarch64-linux-gnu
apt-get clean
EOF

COPY --from=openssl /etc/ld.so.conf.d/lib64.conf /etc/ld.so.conf.d/lib64.conf
COPY --from=openssl /usr/local/lib64 /usr/local/lib64
COPY --from=openssl /usr/local/include/openssl /usr/local/include/openssl
COPY --from=openssl /usr/local/bin/openssl /usr/local/bin/openssl
COPY --from=openssl /usr/local/bin/c_rehash /usr/local/bin/c_rehash
COPY --from=openssl /usr/local/ssl /usr/local/ssl
COPY --from=openssl /usr/local/share/man /usr/local/share/man
COPY --from=openssl /usr/local/share/doc/openssl /usr/local/share/doc/openssl

RUN ldconfig

WORKDIR /work

CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion frontend/src/components/webauthn/WebauthnRequest.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
let progress = tweened(data.exp, {
duration: data.exp * 1000,
})
// close this component automatically, when the request has expired
onMount(() => {
let timer = setTimeout(() => {
Expand Down
41 changes: 24 additions & 17 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ map_docker_user := if docker == "podman" { "" } else { "-u $USER" }
cargo_home := `echo ${CARGO_HOME:-$HOME/.cargo}`

builder_image := "ghcr.io/sebadob/rauthy-builder"
builder_tag_date := "20240919"
builder_tag_date := "20240923"

container_network := "rauthy-dev"
container_mailcrab := "rauthy-mailcrab"
Expand Down Expand Up @@ -373,7 +373,7 @@ build no-test="test" image="ghcr.io/sebadob/rauthy": build-ui
just test-sqlite
fi

make sure any big testing sqlite backups are cleaned up to speed up docker build
# make sure any big testing sqlite backups are cleaned up to speed up docker build
rm -rf data/backup out
mkdir -p out/empty

Expand All @@ -389,7 +389,7 @@ build no-test="test" image="ghcr.io/sebadob/rauthy": build-ui
{{map_docker_user}} \
-e {{db_url_sqlite}} \
--net host \
{{builder_image}}:amd64-{{builder_tag_date}} \
{{builder_image}}:{{builder_tag_date}} \
cargo build --release --target x86_64-unknown-linux-gnu
cp target/x86_64-unknown-linux-gnu/release/rauthy out/rauthy_amd64

Expand Down Expand Up @@ -424,7 +424,7 @@ build no-test="test" image="ghcr.io/sebadob/rauthy": build-ui
-w /work \
{{map_docker_user}} \
--net {{container_network}} \
{{builder_image}}:amd64-{{builder_tag_date}} \
{{builder_image}}:{{builder_tag_date}} \
cargo build --release --features postgres --target x86_64-unknown-linux-gnu
cp target/x86_64-unknown-linux-gnu/release/rauthy out/rauthy_amd64

Expand All @@ -447,22 +447,29 @@ build-builder image="ghcr.io/sebadob/rauthy-builder" push="push":
# using bookworm instead of bullseye because of the newer, bug free gcc
{{docker}} build \
-t {{image}}:amd64-$TODAY \
-t {{image}}:$TODAY \
-f Dockerfile_builder \
--build-arg="IMAGE=rust:1.81-bookworm" \
--no-cache \
.

{{docker}} pull ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main
{{docker}} build \
-t {{image}}:arm64-$TODAY \
-f Dockerfile_builder \
--build-arg="IMAGE=ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" \
--no-cache \
.

{{docker}} push {{image}}:amd64-$TODAY
{{docker}} push {{image}}:arm64-$TODAY
{{docker}} push {{image}}:$TODAY
# # using bookworm instead of bullseye because of the newer, bug free gcc
# {{docker}} build \
# -t {{image}}:amd64-$TODAY \
# -f Dockerfile_builder \
# --build-arg="IMAGE=rust:1.81-bookworm" \
# --no-cache \
# .
#
# {{docker}} pull ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main
# {{docker}} build \
# -t {{image}}:arm64-$TODAY \
# -f Dockerfile_builder \
# --build-arg="IMAGE=ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" \
# --no-cache \
# .
#
# {{docker}} push {{image}}:amd64-$TODAY
# {{docker}} push {{image}}:arm64-$TODAY


# makes sure everything is fine
Expand Down

0 comments on commit 54bc517

Please sign in to comment.