-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
49 lines (38 loc) · 1.56 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
FROM python:3.12.7
WORKDIR /app
RUN python -m venv /app/venv
COPY requirements.txt /app
RUN /app/venv/bin/pip install -U pip setuptools && \
/app/venv/bin/pip install -r requirements.txt
FROM python:3.12.7-slim
COPY . /app
COPY --from=0 /app/venv /app/venv
RUN mkdir -p /app/opbeans/static/
COPY --from=opbeans/opbeans-frontend:latest /app/build /app/opbeans/static/build
## To get the client name/version from package.json
COPY --from=opbeans/opbeans-frontend:latest /app/package.json /app/opbeans/static/package.json
WORKDIR /app
ENV PATH="/app/venv/bin:$PATH"
## curl is required for healthcheck, bzip2 to unzip the sqlite database
RUN apt-get -qq update \
&& apt-get -qq install -y \
bzip2 \
curl \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN sed 's/<head>/<head>{% block head %}{% endblock %}/' /app/opbeans/static/build/index.html | sed 's/<script type="text\/javascript" src="\/rum-config.js"><\/script>//' > /app/opbeans/templates/base.html
# init demo database
RUN mkdir -p /app/demo \
&& DATABASE_URL="sqlite:////app/demo/db.sql" python ./manage.py migrate
ENV ENABLE_JSON_LOGGING=True
ENV ELASTIC_APM_USE_STRUCTLOG=True
EXPOSE 3000
LABEL \
org.label-schema.schema-version="1.0" \
org.label-schema.vendor="Elastic" \
org.label-schema.name="opbeans-python" \
org.label-schema.version="6.23.0" \
org.label-schema.url="https://hub.docker.com/r/opbeans/opbeans-python" \
org.label-schema.vcs-url="https://github.com/elastic/opbeans-python" \
org.label-schema.license="MIT"
CMD ["honcho", "start", "--no-prefix"]