-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.service_and_web
42 lines (31 loc) · 1.2 KB
/
Dockerfile.service_and_web
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
# Copyright 2024 The benchmarks Authors
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
# Build with:
# docker build -t quickwit/benchmark_service_and_web -f Dockerfile.service_and_web .
FROM python:3.12-slim-bookworm
RUN apt-get -y update
RUN apt-get -y install npm
COPY ./service/requirements.txt /service/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /service/requirements.txt --break-system-packages
# Trick not to rebuild app's deps every time there is a code change.
# https://bitjudo.com/blog/2014/03/13/building-efficient-dockerfiles-node-dot-js/
COPY ./web/package.json /tmp/package.json
COPY ./web/package-lock.json /tmp/package-lock.json
WORKDIR /tmp
RUN npm install
WORKDIR /
COPY ./web /web
RUN rm -Rf /web/node_modules
RUN cp -a /tmp/node_modules /web
WORKDIR /web
RUN npm run build
# Now the website is built under /web/build
WORKDIR /
COPY ./service/ /service/
# Local equivalent:
# uvicorn service.main:app --reload --log-config=service/log_conf.yaml --port=80
ENTRYPOINT ["uvicorn", "service.main:app", "--host", "0.0.0.0", "--log-config", "service/log_conf.yaml"]
CMD ["--port", "80"]