From 9de9fd6ef492c97da97e2be86bc60aca961c4721 Mon Sep 17 00:00:00 2001
From: Linfeng Qian <thewawar@gmail.com>
Date: Thu, 11 Aug 2022 11:52:55 +0800
Subject: [PATCH] Add docker files

---
 docker/Dockerfile.aarch64 | 21 +++++++++++++++++++++
 docker/Dockerfile.x86_64  | 21 +++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 docker/Dockerfile.aarch64
 create mode 100644 docker/Dockerfile.x86_64

diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64
new file mode 100644
index 0000000..fa575a0
--- /dev/null
+++ b/docker/Dockerfile.aarch64
@@ -0,0 +1,21 @@
+# This file is copied from: https://github.com/k4yt3x/simple-http-server/blob/master/Dockerfile
+# LICENS: BSD 2-Clause "Simplified" License
+#    please see https://github.com/k4yt3x/simple-http-server/blob/master/LICENSE for more details
+
+FROM rust:1.61-alpine3.15 as builder
+# branch name or tag
+ARG BRANCH
+RUN apk add --no-cache --virtual .build-deps git make musl-dev openssl-dev perl pkgconfig \
+    && git clone -b $BRANCH https://github.com/TheWaWaR/simple-http-server.git /simple-http-server \
+    && RUSTFLAGS='-C link-arg=-s' cargo build --release --target aarch64-unknown-linux-musl --manifest-path=/simple-http-server/Cargo.toml
+
+FROM gcr.io/distroless/static:nonroot
+LABEL maintainer="thewawar <thewawar@gmail.com>" \
+    org.opencontainers.image.source="https://github.com/TheWaWaR/simple-http-server" \
+    org.opencontainers.image.description="A minimal distroless container image for TheWaWaR/simple-http-server"
+COPY --from=builder \
+    /simple-http-server/target/aarch64-unknown-linux-musl/release/simple-http-server \
+    /usr/local/bin/simple-http-server
+USER nonroot:nonroot
+WORKDIR /var/www/html
+ENTRYPOINT ["/usr/local/bin/simple-http-server"]
diff --git a/docker/Dockerfile.x86_64 b/docker/Dockerfile.x86_64
new file mode 100644
index 0000000..6e5c1cc
--- /dev/null
+++ b/docker/Dockerfile.x86_64
@@ -0,0 +1,21 @@
+# This file is copied from: https://github.com/k4yt3x/simple-http-server/blob/master/Dockerfile
+# LICENS: BSD 2-Clause "Simplified" License
+#    please see https://github.com/k4yt3x/simple-http-server/blob/master/LICENSE for more details
+
+FROM rust:1.61-alpine3.15 as builder
+# branch name or tag
+ARG BRANCH
+RUN apk add --no-cache --virtual .build-deps git make musl-dev openssl-dev perl pkgconfig \
+    && git clone -b $BRANCH https://github.com/TheWaWaR/simple-http-server.git /simple-http-server \
+    && RUSTFLAGS='-C link-arg=-s' cargo build --release --target x86_64-unknown-linux-musl --manifest-path=/simple-http-server/Cargo.toml
+
+FROM gcr.io/distroless/static:nonroot
+LABEL maintainer="thewawar <thewawar@gmail.com>" \
+    org.opencontainers.image.source="https://github.com/TheWaWaR/simple-http-server" \
+    org.opencontainers.image.description="A minimal distroless container image for TheWaWaR/simple-http-server"
+COPY --from=builder \
+    /simple-http-server/target/x86_64-unknown-linux-musl/release/simple-http-server \
+    /usr/local/bin/simple-http-server
+USER nonroot:nonroot
+WORKDIR /var/www/html
+ENTRYPOINT ["/usr/local/bin/simple-http-server"]
-- 
GitLab