diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6fcbe95..e0bdda2 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -59,7 +59,7 @@ jobs: uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 with: context: . - platforms: linux/amd64,linux/arm64,linux/armv7 + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }}, windoze/clip-sync-server:latest, windoze/clip-sync-server:${{ github.sha }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index c329411..6d1a648 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,30 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx ARG TARGETARCH -FROM --platform=$BUILDPLATFORM rust:alpine AS builder -ENV OPENSSL_STATIC=yes -RUN apk add musl-dev alpine-sdk perl clang lld && rustup target add wasm32-unknown-unknown && cargo install dioxus-cli +FROM messense/rust-musl-cross:x86_64-musl-amd64 AS builder-amd64 +FROM messense/rust-musl-cross:aarch64-musl-amd64 AS builder-arm64 + +FROM builder-${TARGETARCH} as builder +ARG TARGETARCH ARG TARGETPLATFORM -WORKDIR /usr/src/clip-sync COPY --from=xx / / +WORKDIR /usr/src/ +COPY . ./ +RUN cargo build --release --no-default-features --features server-only --target=$(xx-info march)-unknown-linux-musl && \ + cp /usr/src/target/$(xx-info march)-unknown-linux-musl/release/clip-sync / + +FROM rust:buster AS ui-builder +WORKDIR /usr/src/clip-sync COPY . . -RUN xx-cargo build --release --no-default-features --features server-only && \ - cd clip-sync-ui && dx build --release +RUN rustup target add wasm32-unknown-unknown && cargo install dioxus-cli +RUN cd clip-sync-ui && dx build --release -FROM --platform=$BUILDPLATFORM alpine +FROM alpine RUN apk add --update openssl bash RUN mkdir /index -COPY --from=builder /usr/src/clip-sync/target/release/clip-sync /app/clip-sync -COPY --from=builder /usr/src/clip-sync/config-server.toml /config/config.toml -COPY --from=builder /usr/src/clip-sync/clip-sync-ui/dist /static-files +COPY --from=builder /clip-sync /app/clip-sync +COPY --from=builder /usr/src/config.toml /config/config.toml +COPY --from=ui-builder /usr/src/clip-sync/clip-sync-ui/dist /static-files EXPOSE 3000 WORKDIR / CMD ["/app/clip-sync", "--config", "/config/config.toml"] diff --git a/config-server.toml b/config-server.toml index c5e22b4..bc63c11 100644 --- a/config-server.toml +++ b/config-server.toml @@ -1,4 +1,3 @@ -roles = ["server"] - [server] endpoint = "0.0.0.0:3000" +index-path = "/index" \ No newline at end of file