-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.arm
37 lines (30 loc) · 1.17 KB
/
Dockerfile.arm
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
FROM arm64v8/alpine:3.14 as builder
# Read https://github.com/AntoniosBarotsis/Rss2Email/wiki/1.-Home#deploying
#
# TLDR; run docker build with `--build-arg compile_flag="--features aws-lambda"`
# if you want to build for Lambda
ARG compile_flag=""
RUN apk add --no-cache curl musl-dev libgcc libstdc++6 alpine-sdk
# RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /opt
RUN rustup target add aarch64-unknown-linux-musl
RUN cargo new --bin rss2email
WORKDIR /opt/rss2email
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
ADD ./benches ./benches
RUN touch src/lib.rs
RUN cargo build --release $compile_flag --target aarch64-unknown-linux-musl
RUN rm ./src/*.rs
RUN rm ./target/aarch64-unknown-linux-musl/release/deps/rss2email*
RUN rm ./target/aarch64-unknown-linux-musl/release/deps/lib*
ADD ./src ./src
RUN cargo build --release $compile_flag --target aarch64-unknown-linux-musl
FROM scratch
WORKDIR /opt/rss2email
COPY --from=builder /opt/rss2email/target/aarch64-unknown-linux-musl/release/rss2email .
COPY .env .
COPY feeds.txt .
CMD ["./rss2email"]