-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
61 lines (45 loc) · 1.44 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
# syntax = docker/dockerfile:1.3
ARG RUST_VERSION=1.67
# rust source compile
FROM --platform=$BUILDPLATFORM rust:$RUST_VERSION-bullseye as builder
ARG BUILDPLATFORM
ARG BUILDOS
ARG BUILDARCH
ARG BUILDVARIANT
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG RUST_TOOLCHAIN
ARG VERSION=0.1.0
ARG CARGO_FLAGS="--release --locked"
COPY . .
RUN cargo build $CARGO_FLAGS && \
# Copy executable out of the cache so it is available in the runtime image.
mkdir -p /tmp/gh-pilot && \
find target -type f \( -name "ghp-server" -o -name "ghp" \) -exec cp -v {} /tmp/gh-pilot/ \;
# Create runtime base minimal image for the target platform executables
FROM --platform=$TARGETPLATFORM bitnami/minideb:bullseye as runtime
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG VERSION
ENV dockerfile_version=$VERSION
ENV dockerfile_build_arch=$BUILDPLATFORM
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get --no-install-recommends install -y \
apt-transport-https \
ca-certificates \
openssl
RUN groupadd --gid 10001 gh-pilot && \
useradd --create-home --no-log-init \
--uid 10000 --gid 10001 gh-pilot
USER gh-pilot:gh-pilot
COPY --from=builder /tmp/gh-pilot/ghp-server /usr/local/bin/ghp-server
COPY --from=builder /tmp/gh-pilot/ghp /usr/local/bin/ghp-cli
EXPOSE 8330
ENTRYPOINT [ "ghp-server" ]
#CMD [ "--non-interactive-mode" ]