forked from owocowe-piatki/home-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
38 lines (26 loc) · 853 Bytes
/
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
# Frontend build stage
FROM node:14-alpine as frontend
# Create app directory
RUN mkdir -p /app
WORKDIR /app
# Install dependencies
COPY frontend/package.json frontend/yarn.lock /app/
RUN yarn install
# Copy app files and build
COPY frontend/ /app/
RUN yarn build
# Main stage - build backend image and copy frontend static files into it
FROM python:3.8-slim
ENV PYTHONUNBUFFERED 1
RUN apt-get update && apt-get install gcc -y && apt-get clean
RUN pip install poetry psycopg2-binary
RUN mkdir -p /app
WORKDIR /app
COPY backend/pyproject.toml backend/poetry.lock /app/
RUN poetry export -f requirements.txt -o requirements.txt
RUN pip install -r requirements.txt
COPY backend/ /app/
# Copy frontend files to static
COPY --from=frontend /app/dist/ /app/static/
COPY --from=frontend /app/dist/sw.js /app/templates/sw.js
CMD ["./entrypoint.sh"]