-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.build
40 lines (24 loc) · 1.01 KB
/
Dockerfile.build
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
FROM rust:slim as rust-builder
COPY . .
RUN apt update
RUN apt install -y curl g++ libssl-dev libfontconfig-dev libharfbuzz-dev
RUN rustup default nightly
RUN cargo install --locked --path .
FROM python:slim as python-builder
RUN pip install supervisor
FROM caddy:builder-alpine as caddy-builder
RUN xcaddy build master --with github.com/caddyserver/cache-handler
FROM python:slim
ENV HOME /home/user
ENV SERVER_PORT 5000
ENV PATH $HOME/app:$PATH
RUN useradd -m -u 1000 user
USER user
WORKDIR $HOME/app
COPY --chown=user --from=caddy-builder /usr/bin/caddy /usr/bin/caddy
COPY --chown=user --from=python-builder /usr/local/bin/supervisord /usr/local/bin/
COPY --chown=user --from=python-builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --chown=user --from=rust-builder /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
COPY --chown=user --from=rust-builder /target/release/tectonic-api $HOME/app
COPY --chown=user supervisord.conf Caddyfile $HOME/app/
CMD ["supervisord"]