-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (46 loc) · 1.58 KB
/
Dockerfile
File metadata and controls
61 lines (46 loc) · 1.58 KB
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
FROM rust:bookworm AS builder
#RUN apt-get update; \
# apt-get install --no-install-recommends -y libssl-dev; \
# rm -rf /var/lib/apt/lists/*; \
# USER=root cargo new --bin app;
RUN cargo install sqlx-cli
WORKDIR /app
# copy manifests
COPY ./Cargo.toml .
COPY ./Cargo.lock .
COPY ./rustfmt.toml .
COPY ./Makefile .
COPY ./docker/local/.env .
COPY ./docker/local/configuration.yaml .
COPY .sqlx .sqlx/
# build this project to cache dependencies
#RUN sqlx database create && sqlx migrate run
# build skeleton and remove src after
#RUN cargo build --release; \
# rm src/*.rs
COPY ./src ./src
# for ls output use BUILDKIT_PROGRESS=plain docker build .
#RUN ls -la /app/ >&2
#RUN sqlx migrate run
#RUN cargo sqlx prepare -- --bin stacker
ENV SQLX_OFFLINE=true
RUN apt-get update && apt-get install --no-install-recommends -y libssl-dev; \
cargo build --release --bin server; \
cargo build --release --bin console --features explain
#RUN ls -la /app/target/release/ >&2
# deploy production
FROM debian:bookworm-slim AS production
RUN apt-get update && apt-get install --no-install-recommends -y libssl-dev ca-certificates;
# create app directory
WORKDIR /app
RUN mkdir ./files && chmod 0777 ./files
# copy binary and configuration files
COPY --from=builder /app/target/release/server .
COPY --from=builder /app/target/release/console .
COPY --from=builder /app/.env .
COPY --from=builder /app/configuration.yaml .
COPY --from=builder /usr/local/cargo/bin/sqlx /usr/local/bin/sqlx
COPY ./access_control.conf.dist ./access_control.conf
EXPOSE 8000
# run the binary
ENTRYPOINT ["/app/server"]