-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
101 lines (73 loc) · 2.26 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# ------------------------------------
# builder image, contains all dev-deps
# ------------------------------------
FROM debian:unstable as builder
WORKDIR /root
# required packages
RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates curl file \
build-essential \
clang \
pkg-config \
cmake \
zlib1g \
zlib1g-dev \
ffmpeg \
libsqlite3-0 \
libsqlite3-dev \
libavcodec-dev \
libavformat-dev \
libavfilter-dev \
libssl-dev \
libavdevice-dev \
libavresample-dev \
autoconf automake autotools-dev libtool xutils-dev && \
rm -rf /var/lib/apt/lists/*
# install toolchain using rustup
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2019-09-06 -y
ENV PATH=/root/.cargo/bin:$PATH
ADD . vorleser-server
WORKDIR /root/vorleser-server
# ------------------
# build web frontend
# ------------------
FROM codesimple/elm:0.18 as web
ADD vorleser-web /app
RUN cd /app && make release
# --------------
# build vorleser
# --------------
FROM builder as vorleser
COPY --from=web /app/elm.js vorleser-web/elm.js
RUN sed -i -e 's/serverUrl: ""/serverUrl: window.location.href/' -e 's/hideUrlField: false/hideUrlField: true/' vorleser-web/audio.js && \
cargo build --features webfrontend --release
# ------------------------------------------
# final image with runtime deps and app only
# ------------------------------------------
FROM debian:unstable
RUN apt-get update && \
apt-get install --no-install-recommends -y \
ffmpeg \
libsqlite3-0 \
libssl1.1 && \
rm -rf /var/lib/apt/lists/*
COPY --from=vorleser /root/vorleser-server/target/release/vorleser_server_bin /usr/local/bin/vorleser-server
VOLUME /var/lib/vorleser
RUN printf '\n\
database = "/var/lib/vorleser/vorleser.sqlite" \n\
data_directory = "/var/lib/vorleser" \n\
register_web = false \n\
[scan] \n\
enabled = true \n\
interval = 600 \n\
[logging] \n\
level = "info" \n\
[web] \n\
address = "0.0.0.0" \n\
port = 8000 \n\
' >> /etc/vorleser.toml
EXPOSE 8000
ENV RUST_BACKTRACE=1
ENTRYPOINT ["vorleser-server", "-c", "/etc/vorleser.toml"]
CMD ["serve"]