-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.build
49 lines (36 loc) · 1.32 KB
/
Dockerfile.build
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
# Use image with both python and node installed
FROM nikolaik/python-nodejs:python3.10-nodejs14-alpine
WORKDIR /app/src/backend
# Install required libraries and Python dependencies
COPY requirements.txt /app/src/backend
RUN \
apk update && \
apk upgrade && \
apk add --no-cache bash postgresql-libs && \
apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev && \
pip3 install --upgrade pip -r requirements.txt && \
apk --purge del .build-deps
# Add the rest of the code
COPY ./src/backend /app/src/backend
# Copy scripts to main directory
COPY ./src/backend/scripts/ /app/
# Install frontend dependencies
WORKDIR /app/src/frontend
COPY ./src/frontend/package.json ./src/frontend/yarn.lock /app/src/frontend/
RUN yarn install
# Add the rest of the code
COPY ./src/frontend /app/src/frontend
# Build react static files
RUN yarn run build
# Move non-static files to newly created dir (/app/src/frontend/build/root/)
RUN cd build && mkdir root && mv *.ico *.json root
# Collect static files
RUN mkdir /app/staticfiles
WORKDIR /app
# Make port 8000 available for the app
ENV PORT 8000
EXPOSE 8000
# Be sure to use 0.0.0.0 for the host within the Docker container,
# otherwise the browser won't be able to find it
RUN ["chmod", "+x", "/app/entrypoint-build.sh"]
ENTRYPOINT [ "/app/entrypoint-build.sh" ]