-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (46 loc) · 1.68 KB
/
Dockerfile
File metadata and controls
64 lines (46 loc) · 1.68 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
62
63
64
FROM node:22-slim AS ui-builder
# We are using a multi-stage build as we require node for
# building react.
# Copy package.json and package-lock.json into the builder.
# Copying just these files first allows us to take advantage
# of cached Docker layers.
# Define UI build arguments.
ARG REACT_APP_SEARCH_NAME
ARG REACT_APP_SEARCH_URL
# Set the build arguments as environment variables.
ENV REACT_APP_SEARCH_NAME=$REACT_APP_SEARCH_NAME
ENV REACT_APP_SEARCH_URL=$REACT_APP_SEARCH_URL
WORKDIR /usr/src/app
COPY ./ui/package.json ./ui/yarn.lock ./
RUN yarn install
# Copy over the rest of the dependencies, source files, etc
COPY ./ui .
# Build the js app for production
RUN yarn run build
# Since we are serving it all from python, switch over to
# a more appropriate base image.
FROM python:3.10-slim as strelka-oss-runner
RUN apt-get -y update
RUN apt-get install -y build-essential libpq-dev libmagic1
# Set Runtime Variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
ENV POETRY_VIRTUALENVS_CREATE=1
# Install Poetry globally and copy project files
RUN python3 -m pip install -U pip setuptools && \
python3 -m pip install poetry && \
rm -rf /root/.cache/pip
# Set the working directory and copy the project files
WORKDIR /app
# Copy only the pyproject.toml and poetry.lock files
COPY ./app/pyproject.toml ./app/poetry.lock ./
RUN poetry install --no-root
COPY ./app/strelka_ui/ ./strelka_ui/
RUN poetry install --only-root
# Copy the production UI assets into the new base image.
COPY --from=ui-builder /usr/src/app/build/ ./strelka_ui/react-app/
# Run App
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]