-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
67 lines (39 loc) · 1.62 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
FROM ghcr.io/prefix-dev/pixi:0.39.5-noble AS install
WORKDIR /app
COPY pyproject.toml .
COPY pixi.lock .
RUN --mount=type=cache,target=/root/.cache/rattler/cache,sharing=private pixi install
RUN pixi shell-hook -e web > /shell-hook-web
RUN echo 'exec "$@"' >> /shell-hook-web
RUN pixi shell-hook -e prepare > /shell-hook-prepare
RUN echo 'exec "$@"' >> /shell-hook-prepare
RUN pixi shell-hook -e mongo > /shell-hook-mongo
RUN echo 'exec "$@"' >> /shell-hook-mongo
#--------------------
FROM install AS rust_build
COPY . .
# Need this to avoid SSL errors. Can this be done only with pixi?
RUN apt-get update && apt-get -y install ca-certificates
RUN pixi run build-server
#--------------------
FROM ubuntu:24.04 AS web
# only copy the production environment into prod container
COPY --from=install /app/.pixi/envs/web /app/.pixi/envs/web
COPY --from=install /shell-hook-web /shell-hook
RUN groupadd user && \
useradd --create-home --home-dir /home/user -g user -s /bin/bash user
COPY app/ /app/web/
WORKDIR /app/web
#USER user
ENTRYPOINT ["/bin/bash", "/shell-hook"]
CMD ["gunicorn", "-b", "0.0.0.0:8000", "--timeout", "120", "--workers", "4", "--access-logfile", "-", "main:app"]
#--------------------
FROM ubuntu:24.04 AS index
COPY --from=rust_build /app/target/release/branchwater-server /app/bin/branchwater-server
WORKDIR /data
EXPOSE 80/tcp
CMD ["/app/bin/branchwater-server", "--port", "80", "-k21", "--location", "/data/sigs.zip", "/data/index"]
#--------------------
FROM docker.io/mongo:latest AS mongo
COPY --from=install /app/.pixi/envs/mongo /app/.pixi/envs/mongo
COPY --from=install /shell-hook-mongo /shell-hook