forked from alexmojaki/futurecoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (36 loc) · 1.25 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
# Stage 1 - Build frontend
FROM node:12 as build-frontend
WORKDIR /usr/src/app
COPY frontend/package-lock.json frontend/package.json ./frontend/
WORKDIR frontend
RUN npm ci
COPY frontend .
RUN npm run build
# Stage 2 - Setup server
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y software-properties-common curl
RUN (cd /etc/apt/trusted.gpg.d/ && curl -O https://www.postgresql.org/media/keys/ACCC4CF8.asc)
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)"-pgdg main > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3.8-dev \
vim \
python3.8-distutils \
gcc \
postgresql-client-12 \
libpq-dev
RUN ln -s /usr/bin/python3.8 /usr/local/bin/python
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python get-pip.py
RUN pip install poetry
WORKDIR /usr/src/app
COPY poetry.lock pyproject.toml ./
RUN poetry config virtualenvs.create false
RUN LC_ALL=C.UTF-8 LANG=C.UTF-8 poetry install --extras "production" --no-dev
COPY --from=build-frontend /usr/src/app/frontend/build ./frontend/build
COPY ./backend ./backend
WORKDIR /usr/src/app/backend
RUN ./manage.py collectstatic --noinput
EXPOSE 3000
CMD ["bash", "./entrypoint.sh"]