Files
rustdesk-server/Dockerfile.ci
T
admin eaaca6cffd
CI and Docker Build / Cargo Check (push) Failing after 17s
CI and Docker Build / Build and Push Docker Image (push) Skipped
CI and Docker Build / Deploy to Remote Server (push) Skipped
ci: 迁移到 Gitea Actions,构建纯 server 镜像
- 新增 Dockerfile.ci:rust musl 静态编译 hbbs/hbbr/rustdesk-utils + alpine/s6(移除 api 服务,避免 21114 冲突)

- 新增 ci-docker.yml(check/docker/deploy)与 docker-compose.prod.yml

- 删除旧的 GitHub Actions 工作流
2026-10-30 04:58:27 +08:00

74 lines
2.5 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 自建 Gitea CI 使用的镜像构建文件
# 与官方 docker/Dockerfile 的区别:
# 1. 编译在构建阶段内完成(rust:1.75 + musl 静态链接),不依赖外部预编译产物
# 2. 基础镜像改为 alpine,不含 apimain(API 由独立的 rustdesk-api 容器提供,避免抢占 21114)
# 3. 保留 s6-overlay 与 key-secret 服务,因此 hbbs 会在首次启动时生成 /data/id_ed25519{,.pub}
#
# 构建(在仓库根目录执行,需要 .git 以拉取 submodule):
# docker build -f Dockerfile.ci -t git.viaeon.com/admin/rustdesk-server:latest .
FROM rust:1.75 AS builder
ARG TARGET=x86_64-unknown-linux-musl
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
musl-tools \
pkg-config \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/* \
&& rustup target add ${TARGET}
WORKDIR /src
COPY . /src
RUN git config --global --add safe.directory '*' \
&& git submodule update --init --recursive
RUN CC_x86_64_unknown_linux_musl=musl-gcc \
CARGO_NET_GIT_FETCH_WITH_CLI=true \
cargo build --release --all-features --target ${TARGET}
RUN mkdir -p /out \
&& cp target/${TARGET}/release/hbbs /out/hbbs \
&& cp target/${TARGET}/release/hbbr /out/hbbr \
&& cp target/${TARGET}/release/rustdesk-utils /out/rustdesk-utils
FROM alpine:3.20
ARG S6_OVERLAY_VERSION=3.2.0.0
ARG S6_ARCH=x86_64
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-${S6_ARCH}.tar.xz \
&& rm -f /tmp/s6-overlay*.tar.xz \
&& ln -s /run /var/run
COPY docker/rootfs/ /
# 去掉 API 服务:本机由单独的 rustdesk-api 容器提供,避免 21114 端口冲突
RUN rm -rf /etc/s6-overlay/s6-rc.d/api \
/etc/s6-overlay/s6-rc.d/user/contents.d/api
COPY --from=builder /out/hbbs /usr/bin/hbbs
COPY --from=builder /out/hbbr /usr/bin/hbbr
COPY --from=builder /out/rustdesk-utils /usr/bin/rustdesk-utils
RUN chmod a+x /usr/bin/hbbs /usr/bin/hbbr /usr/bin/rustdesk-utils /usr/bin/healthcheck.sh
ENV RELAY=relay.example.com
ENV ENCRYPTED_ONLY=0
VOLUME /data
WORKDIR /data
EXPOSE 21115 21116 21116/udp 21117 21118 21119
HEALTHCHECK --interval=10s --timeout=5s CMD /usr/bin/healthcheck.sh
ENTRYPOINT ["/init"]