-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
61 lines (46 loc) · 1.42 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM alpine:latest AS build-env
# 修改Alpine镜像地址
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 设置rustup安装代理环境
ENV RUSTUP_DIST_SERVER="https://rsproxy.cn"
ENV RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
# 安装依赖库
RUN apk update
RUN apk add -u --no-cache gcc
RUN apk add -u --no-cache musl-dev
RUN apk add -u --no-cache wget
# 安装rustup
RUN mkdir /tmp/run
RUN wget https://rsproxy.cn/rustup-init.sh
RUN sh rustup-init.sh -y --profile minimal --no-modify-path
# 链接rustup和cargo到/usr/local/bin
RUN ln -s $HOME/.cargo/bin/rustup /usr/local/bin/rustup
RUN ln -s $HOME/.cargo/bin/cargo /usr/local/bin/cargo
# 导入cargo配置
COPY proxy_config /
RUN mv /proxy_config $HOME/.cargo/config
WORKDIR /satex
# 复制文件
COPY src ./src
COPY satex-core ./satex-core
COPY satex-serve ./satex-serve
COPY satex-matcher ./satex-matcher
COPY satex-layer ./satex-layer
COPY satex-service ./satex-service
COPY satex-discovery ./satex-discovery
COPY Cargo.toml .
COPY Cargo.lock .
# 编译
RUN cargo build --release
FROM alpine:latest
WORKDIR /satex
# 复制构建文件
COPY --from=build-env /satex/target/release/satex ./bin/
# 复制配置文件
COPY examples/docker/satex.yaml ./conf/
COPY examples/docker/static.yaml ./conf/
COPY examples/resources ./static/
# 暴露端口
EXPOSE 80
# 启动
ENTRYPOINT ["/satex/bin/satex","-c","/satex/conf/satex.yaml"]