ew/Dockerfile
2025-01-15 10:27:43 +08:00

56 lines
1.4 KiB
Docker

# 打包命令
# docker buildx build -t zhushenwudi/lovelive-sif2:1.0.2 -t zhushenwudi/lovelive-sif2:latest --platform=linux/amd64 .
# 使用适用于 Linux x86 的基础映像
# 保存镜像
# docker save -o lovelive-sif2.tar zhushenwudi/lovelive-sif2:1.0.2
FROM docker.io/library/debian:latest AS builder
# First - build
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
RUN apt update && apt install -y curl libssl-dev perl git gcc make
RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash
RUN apt update && apt install -y nodejs
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable --profile minimal
ENV TZ=Asia/Shanghai
RUN ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
RUN rm -rf /etc/localtime
RUN ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
WORKDIR /ew/
COPY ./ ./
RUN rm -f ./*.db
RUN rm -f ./*.lock
RUN rm -rf ./.idea
RUN rm -rf ./target
RUN rm -rf ./webui/node_modules
RUN rm -rf ./webui/dist
RUN rm -rf ./webui/*.lock
WORKDIR /ew/webui/
RUN npm i && npm run build
WORKDIR /ew/
RUN . "$HOME/.cargo/env" && cargo build --release
## Second - sort stuff idk
FROM docker.io/library/debian:bookworm-slim
RUN mkdir -p /root/ew/
COPY --from=builder /ew/target/release/ew /root/ew/ew
COPY ./docker/start.sh /root/ew/start.sh
RUN chmod +x /root/ew/start.sh
EXPOSE 8080
EXPOSE 8000
ENTRYPOINT ["/root/ew/start.sh"]