Update Dockerfile for multiarch image.

This commit is contained in:
Viyurz 2024-02-25 19:05:26 +01:00
parent acf536b232
commit 962df33503
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
4 changed files with 105 additions and 15 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
target
.idea
assets/index.css

View file

@ -1,7 +1,15 @@
# Build image
FROM docker.io/rust:alpine AS build
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:x86_64-musl-stable as build_amd64
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:aarch64-musl-stable as build_arm64
RUN apk add --no-cache musl-dev
# Build image
FROM --platform=$BUILDPLATFORM build_${TARGETARCH} as build
COPY --from=xx / /
ARG TARGETARCH
ARG TARGETVARIANT
ARG TARGETPLATFORM
RUN echo "export CARGO_TARGET=${RUST_MUSL_CROSS_TARGET}" > /env-cargo
WORKDIR /usr/src
@ -10,10 +18,17 @@ RUN cargo new homepage
WORKDIR /usr/src/homepage
RUN source /env-cargo && \
rustup target add "${CARGO_TARGET}"
COPY Cargo.* ./
# Dummy build to cache dependencies
RUN cargo build --release
RUN source /env-cargo && \
cargo build --release --target "${CARGO_TARGET}"
RUN curl -Lo tailwindcss https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 && \
chmod +x tailwindcss
COPY src ./src
@ -21,7 +36,12 @@ COPY templates ./templates
# Build the actual app
RUN touch src/main.rs && \
cargo build --release
source /env-cargo && \
cargo install --path . --target "${CARGO_TARGET}"
COPY tailwind.* ./
RUN ./tailwindcss -i tailwind.css -o index.css --minify
@ -40,8 +60,13 @@ USER homepage:homepage
EXPOSE 8080
COPY --from=build /usr/src/homepage/target/release/homepage /usr/local/bin/homepage
COPY --from=build /root/.cargo/bin/homepage /usr/local/bin/homepage
COPY assets ./assets
# Copy CSS generated by Tailwind
COPY --from=build /usr/src/homepage/index.css assets/
COPY services.toml .
ENTRYPOINT ["homepage"]

71
services.toml Normal file
View file

@ -0,0 +1,71 @@
[[services]]
name = "Element"
description = "Web client of Element, an instant messaging client implementing the Matrix protocol."
domain = "element.viyurz.fr"
image = "/assets/element.png"
language = "TypeScript"
repository_url = "https://github.com/element-hq/element-web"
[[services]]
name = "EteBase"
description = "Server for EteSync, an end-to-end encrypted contacts, calendars, tasks and notes provider."
domain = "etebase.viyurz.fr"
image = "/assets/etesync.png"
language = "Python"
repository_url = "https://github.com/etesync/server"
[[services]]
name = "EteSync (Soon™)"
description = "Web client of EteSync, an end-to-end encrypted contacts, calendars, tasks and notes provider."
domain = "etesync.viyurz.fr"
image = "/assets/etesync.png"
language = "TypeScript"
repository_url = "https://github.com/etesync/etesync-web"
[[services]]
name = "HedgeDoc"
description = "A real-time collaborative markdown editor."
domain = "hedgedoc.viyurz.fr"
image = "/assets/hedgedoc.png"
language = "TypeScript"
repository_url = "https://github.com/hedgedoc/hedgedoc"
[[services]]
name = "Matrix"
description = "Synapse homeserver implemeting the Matrix protocol, an open standard for real-time communication supporting encryption and VoIP."
domain = "matrix.viyurz.fr"
image = "/assets/matrix.png"
language = "Python"
repository_url = "https://github.com/element-hq/synapse"
[[services]]
name = "SearXNG"
description = "A privacy-respecting, hackable metasearch engine."
domain = "searx.viyurz.fr"
image = "/assets/searxng.png"
language = "Python"
repository_url = "https://github.com/searxng/searxng"
[[services]]
name = "Stalwart Mail Server (Soon™)"
description = "Secure & Modern All-in-One Mail Server (IMAP, JMAP, SMTP)."
domain = "smtp.viyurz.fr"
image = "/assets/mail-server.png"
language = "Rust"
repository_url = "https://github.com/stalwartlabs/mail-server"
[[services]]
name = "Stump (Soon™)"
description = "A comics, manga and digital book server with OPDS support (WIP)."
domain = "stump.viyurz.fr"
image = "/assets/stump.png"
language = "Rust / TypeScript"
repository_url = "https://github.com/stumpapp/stump"
[[services]]
name = "Vaultwarden"
description = "Rust rewrite of the Bitwarden server, a password management service."
domain = "vw.viyurz.fr"
image = "/assets/vaultwarden.png"
language = "Rust"
repository_url = "https://github.com/dani-garcia/vaultwarden"

View file

@ -1,7 +0,0 @@
[[services]]
name = "My service"
description = "My service description."
domain = "myservice.viyurz.fr"
image = "/assets/myservice.png"
language = "MyLanguage"
repository_url = "https://github.com/myservicerepository"