forked from libreddit/libreddit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.armv7
43 lines (30 loc) · 1.53 KB
/
Dockerfile.armv7
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
####################################################################################################
## Builder
####################################################################################################
FROM --platform=$BUILDPLATFORM rust:slim AS builder
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER=arm-linux-gnueabihf-gcc
ENV CC_armv7_unknown_linux_musleabihf=arm-linux-gnueabihf-gcc
RUN apt-get update && apt-get -y install gcc-arm-linux-gnueabihf \
binutils-arm-linux-gnueabihf \
musl-tools
RUN rustup target add armv7-unknown-linux-musleabihf
WORKDIR /libreddit
COPY . .
RUN cargo build --target armv7-unknown-linux-musleabihf --release
####################################################################################################
## Final image
####################################################################################################
FROM alpine:latest
# Import ca-certificates from builder
COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
# Copy our build
COPY --from=builder /libreddit/target/armv7-unknown-linux-musleabihf/release/libreddit /usr/local/bin/libreddit
# Use an unprivileged user.
RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
USER libreddit
# Tell Docker to expose port 8080
EXPOSE 8080
# Run a healthcheck every minute to make sure Libreddit is functional
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
CMD ["libreddit"]