summaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-25 20:50:57 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-25 20:50:57 -0700
commitc301c0fa0e6b409e1682a0dc75ae50b34e56457c (patch)
treea95e579ad932c0369559fc5f94cfabdf9a329355 /extra
parent03fac454b613662c354ffefbad9f758f1ce23259 (diff)
downloades-public-proxy-c301c0fa0e6b409e1682a0dc75ae50b34e56457c.tar.gz
es-public-proxy-c301c0fa0e6b409e1682a0dc75ae50b34e56457c.zip
add a basic Dockerfile
Diffstat (limited to 'extra')
-rw-r--r--extra/Dockerfile42
1 files changed, 42 insertions, 0 deletions
diff --git a/extra/Dockerfile b/extra/Dockerfile
new file mode 100644
index 0000000..3704acf
--- /dev/null
+++ b/extra/Dockerfile
@@ -0,0 +1,42 @@
+# build image
+FROM ekidd/rust-musl-builder:stable as builder
+
+# pre-build dependencies in a fake workplace
+RUN USER=root cargo new --bin es-public-proxy
+WORKDIR ./es-public-proxy
+COPY ./Cargo.lock ./Cargo.lock
+COPY ./Cargo.toml ./Cargo.toml
+RUN cargo build --release
+RUN rm src/*.rs
+
+# then mount in real source code (which may have been updated during dev) and build release binary
+ADD . ./
+
+RUN rm ./target/x86_64-unknown-linux-musl/release/deps/es_public_proxy*
+RUN cargo build --release
+
+# from here, the application environment
+FROM alpine:latest
+
+ARG APP=/usr/src/app
+
+EXPOSE 9292
+
+ENV TZ=Etc/UTC \
+ APP_USER=appuser
+
+RUN addgroup -S $APP_USER \
+ && adduser -S -g $APP_USER $APP_USER
+
+RUN apk update \
+ && apk add --no-cache ca-certificates tzdata \
+ && rm -rf /var/cache/apk/*
+
+COPY --from=builder /home/rust/src/es-public-proxy/target/x86_64-unknown-linux-musl/release/es-public-proxy ${APP}/es-public-proxy
+
+RUN chown -R $APP_USER:$APP_USER ${APP}
+
+USER $APP_USER
+WORKDIR ${APP}
+
+CMD ["./es-public-proxy", "--unsafe-all-indices"]