forked from varphi-online/guestbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (26 loc) · 891 Bytes
/
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
FROM rust:1.69-alpine AS builder
RUN apk add ca-certificates musl-dev
WORKDIR /usr/src/guestbook
COPY Cargo.toml .
COPY Cargo.lock .
# Hack to populate cache
RUN mkdir src && echo 'fn main() {}' > src/main.rs && \
cargo build --release
COPY . .
RUN cargo build --release
# Start a fresh image
FROM alpine
ENV RUST_BACKTRACE=1
WORKDIR /usr/src/guestbook
RUN apk add --no-cache sqlite-libs sqlite
RUN mkdir -p /usr/src/guestbook/data
COPY --from=builder /usr/src/guestbook/target/release/guestbook ./guestbook
RUN chmod +x ./guestbook
COPY --from=builder /usr/src/guestbook/index.html ./
COPY --from=builder /usr/src/guestbook/index.css ./
COPY --from=builder /usr/src/guestbook/page_not_found.html ./
COPY --from=builder /usr/src/guestbook/W95FA.otf ./
COPY --from=builder /usr/src/guestbook/htmx.min.js ./
VOLUME ["/usr/src/guestbook/data"]
EXPOSE 8080
CMD ["./guestbook"]