This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (40 loc) · 1.78 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
FROM rust:1.62-alpine as build
ARG BUILD_VERSION=0.0.0-development
RUN apk add --update --no-cache openssl-dev musl-dev protoc
RUN rustup component add rustfmt
WORKDIR /app
COPY . .
ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN sed -i -e "s/^version = .*/version = \"${BUILD_VERSION}\"/" Cargo.toml
RUN cargo install --path .
FROM alpine:3.16
ARG BUILD_VERSION=0.0.0-development
ARG COMMIT_SHA=NOT_AVAILABLE
LABEL org.opencontainers.image.authors="[email protected]" \
org.opencontainers.image.url="https://github.com/WirePact/k8s-contract-repository" \
org.opencontainers.image.documentation="https://github.com/WirePact/k8s-contract-repository/blob/main/README.md" \
org.opencontainers.image.source="https://github.com/WirePact/k8s-contract-repository/blob/main/api/Dockerfile" \
org.opencontainers.image.version="${BUILD_VERSION}" \
org.opencontainers.image.revision="${COMMIT_SHA}" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.title="WirePact Contract Repository API" \
org.opencontainers.image.description="API for the WirePact contract repository. Manages contracts between PKIs in WirePact to allow distributed authentication."
WORKDIR /app
ENV USER=appuser \
UID=1000 \
BUILD_VERSION=${BUILD_VERSION} \
PORT=8080
COPY --from=build /usr/local/cargo/bin/k8s-contract-repository /usr/local/bin/k8s-contract-repository
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}" && \
chown -R appuser:appuser /app && \
chmod +x /usr/local/bin/k8s-contract-repository && \
apk add --update --no-cache libgcc ca-certificates
USER appuser:appuser
ENTRYPOINT ["/usr/local/bin/k8s-contract-repository"]