Add a dockerfile which may or may not work

This commit is contained in:
R Tyler Croy 2020-10-11 11:27:48 -07:00
parent 77a39f8b9f
commit 414ed530a9
3 changed files with 37 additions and 1 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
target/debug
target/rls
target/release/build
target/release/deps
target/release/examples
target/release/incremental
node_modules/

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
# 1: Build the exe
FROM rust:latest as builder
WORKDIR /usr/ddv
# 1a: Prepare for static linking
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y libssl-dev && \
rustup toolchain add stable
# 1c: Build the exe using the actual source code
COPY Cargo.toml .
COPY src ./src
RUN cargo build --release
# 2: Copy the exe and extra files ("static") to an empty Docker image
FROM debian:10-slim
COPY --from=builder /usr/ddv/target/release/dotdotvote .
COPY apidocs ./apidocs
COPY views ./views
COPY assets ./static
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y libssl-dev
USER 1000
CMD ["./dotdotvote"]

View File

@ -1,6 +1,6 @@
<header class="masthead">
<div class="inner">
<h3 class="masthead-brand">Dot dot vote</h3>
<h1 class="masthead-brand">Dot dot vote</h1>
<nav class="nav nav-masthead justify-content-center">
<a class="nav-link" href="/">Home</a>
<a class="nav-link" href="/about">About</a>