This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gather.Dockerfile
63 lines (46 loc) · 1.88 KB
/
gather.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
################################################################################
## using alpine image to build version and revision files
################################################################################
FROM alpine AS app_resource
WORKDIR /tmp
COPY ./.git /tmp/.git
COPY ./app/conf/docker/setup_revision.sh /tmp/setup_revision.sh
RUN /tmp/setup_revision.sh
################################################################################
## using node image to build react app
################################################################################
FROM node:14-alpine AS app_node
WORKDIR /node/
## copy application version and git revision
COPY --from=app_resource /tmp/resources/. /var/tmp/
## copy source code
COPY ./app/gather/assets/ /node/
## build react app
RUN npm install -s --no-audit --no-fund --no-package-lock && \
npm run build
################################################################################
## using python image to build app
################################################################################
FROM python:3.10-slim AS app
LABEL description="Gather 3 > Effortless data collection and curation" \
name="gather" \
author="eHealth Africa"
## set up container
WORKDIR /code
ENTRYPOINT ["/code/entrypoint.sh"]
COPY ./app/conf/docker/* /tmp/
RUN /tmp/setup.sh
## copy source code
COPY --chown=gather:gather ./app/ /code/
## install dependencies
ENV VIRTUAL_ENV=/var/run/gather/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN mkdir -p $VIRTUAL_ENV && \
python3 -m venv $VIRTUAL_ENV && \
pip install -q --upgrade pip && \
pip install -q -r /code/conf/pip/requirements.txt
## copy react app
RUN rm -Rf /code/gather/assets/
COPY --from=app_node --chown=gather:gather /node/bundles/. /code/gather/assets/bundles
## copy application version and revision
COPY --from=app_resource --chown=gather:gather /tmp/resources/. /var/tmp/