-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
54 lines (43 loc) · 1.64 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
# syntax=docker/dockerfile:experimental
# Build stage: Install python dependencies
# ===
FROM ubuntu:jammy AS python-dependencies
RUN apt-get update && apt-get install --no-install-recommends --yes python3 python3-setuptools python3-pip
ADD requirements.txt /tmp/requirements.txt
RUN pip3 config set global.disable-pip-version-check true
RUN --mount=type=cache,target=/root/.cache/pip pip3 install --user --requirement /tmp/requirements.txt
# Build stage: Install yarn dependencies
# ===
FROM node:19 AS yarn-dependencies
WORKDIR /srv
ADD package.json yarn.lock .
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install
# Build stage: React app
# ===
FROM yarn-dependencies AS frontend-build
ADD client client
ADD tsconfig.json tsconfig.json
ADD tsconfig.node.json tsconfig.node.json
ADD vite.config.ts vite.config.ts
RUN yarn run build
# Build the production image
# ===
FROM ubuntu:jammy
# Install python and import python dependencies
RUN apt-get update && apt-get install --no-install-recommends --yes python3 python3-setuptools ca-certificates libsodium-dev python3-lib2to3
COPY --from=python-dependencies /root/.local/lib/python3.10/site-packages /root/.local/lib/python3.10/site-packages
COPY --from=python-dependencies /root/.local/bin /root/.local/bin
WORKDIR /srv
COPY . .
ENV PATH="/root/.local/bin:${PATH}"
RUN rm -rf package.json yarn.lock .babelrc webpack.config.js requirements.txt
COPY --from=frontend-build /srv/static static
# Build specs json file
ARG PRIVATE_KEY
ARG PRIVATE_KEY_ID
# Set git commit ID
ARG BUILD_ID
ENV TALISKER_REVISION_ID "${BUILD_ID}"
# Setup commands to run server
ENTRYPOINT ["./entrypoint"]
CMD ["0.0.0.0:80"]