-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (36 loc) · 1.45 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
## Builder
####################################################################################################
FROM rust:bullseye AS builder
WORKDIR /backend
RUN apt-get update && apt-get install -y curl build-essential clang && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
RUN mkdir -p data
RUN touch data/database.sqlite
# We install sqlx-cli before copying to use the default Rust version and
# not the specified nightly inside rust-toolchain file (which doesn't work)
RUN cargo install sqlx-cli
COPY ./ .
RUN cp .env.example .env && \
sqlx database reset -y && \
cargo build --release --features lmmd,dynamodb && \
cd static/ && npm install && cd .. && \
cp target/release/findex_cloud /usr/bin/findex_cloud
####################################################################################################
## Final image
####################################################################################################
FROM debian:bullseye
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /backend
RUN apt-get update && \
apt-get install --no-install-recommends -qq -y \
libssl-dev ca-certificates && \
rm -fr /var/lib/apt/lists/*
RUN mkdir static
COPY --from=builder /usr/bin/findex_cloud* /usr/bin/
COPY --from=builder /backend/static/ /backend/static/
ENV DATABASE_URL=sqlite://data/database.sqlite
RUN mkdir -p data
RUN touch data/database.sqlite
EXPOSE 8080
CMD ["findex_cloud"]