-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (22 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
27 lines (22 loc) · 1.01 KB
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
FROM --platform=$BUILDPLATFORM rust:alpine AS builder
RUN apk add --no-cache musl-dev zig && \
rustup target add x86_64-unknown-linux-musl aarch64-unknown-linux-musl && \
cargo install cargo-zigbuild
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/app/target \
cargo zigbuild --release --target x86_64-unknown-linux-musl --target aarch64-unknown-linux-musl && \
mkdir -p /out/linux/ && \
cp target/x86_64-unknown-linux-musl/release/ghstats /out/linux/amd64 && \
cp target/aarch64-unknown-linux-musl/release/ghstats /out/linux/arm64
FROM alpine:latest AS runtime
LABEL org.opencontainers.image.source="https://github.com/vladkens/ghstats"
WORKDIR /app
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
ARG TARGETPLATFORM
COPY --from=builder /out/${TARGETPLATFORM} /app/ghstats
ENV HOST=0.0.0.0 PORT=8080
EXPOSE ${PORT}
HEALTHCHECK CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/health || exit 1
CMD ["/app/ghstats"]