构建镜像

  1. 导航到1Panel的容器页面——镜像——构建镜像——编辑DockerFile
FROM ubuntu:22.04

RUN apt-get update && apt-get -y upgrade && apt-get install -y curl git build-essential pkg-config openssl libssl-dev

RUN export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static && \
    export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup && \
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN mkdir -p /root/.cargo && \
    echo '[source.crates-io]' > /root/.cargo/config && \
    echo 'replace-with = "ustc-sparse"' >> /root/.cargo/config && \
    echo '[source.ustc-sparse]' >> /root/.cargo/config && \
    echo 'registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"' >> /root/.cargo/config
WORKDIR /root/
RUN git clone https://gh-proxy.org/https://github.com/TeamFlos/phira-mp.git
WORKDIR /root/phira-mp
RUN cargo build --release -p phira-mp-server

ENV PORT=12346 #容器端口

ENTRYPOINT ["/root/phira-mp/target/release/phira-mp-server", "--port", "$PORT"]
  1. 构建成功后,镜像页面应产生新镜像(phira:latest)
    2026-03-03T00:13:42.png

部署Docker容器

返回到容器页面——创建容器——选择镜像为phira:latest
暴露端口8080 -> 12346
2026-03-03T00:15:39.png

单击确认来部署容器
然后启动Phira并添加服务器IP:端口来测试
2026-03-03T00:19:20.png
2026-03-03T00:20:40.png