forked from bocabitlabs/buho-stocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (43 loc) · 1.49 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
50
51
52
53
54
55
56
57
58
59
FROM tiangolo/uwsgi-nginx:python3.10
RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get -y install nodejs
RUN npm install
VOLUME /usr/src/data
VOLUME /usr/src/media
RUN npm install --global yarn
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH "${PYTHONPATH}:/usr/src"
ENV LISTEN_PORT 34800
ENV UWSGI_INI /usr/src/uwsgi.ini
COPY ./uwsgi.ini /usr/src/uwsgi.ini
COPY ./nginx-app.conf /etc/nginx/conf.d/custom.conf
COPY ./prestart.sh /app/prestart.sh
# install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt /usr/src
RUN pip install --no-cache-dir --upgrade -r /usr/src/requirements.txt
WORKDIR /usr/src/client
COPY ./client/package.json /usr/src/client/package.json
COPY ./client/yarn.lock /usr/src/client/yarn.lock
RUN yarn --production --pure-lockfile
COPY ./client /usr/src/client
RUN yarn build
RUN rm -rf /usr/src/client/node_modules/
RUN mkdir /app/frontend/
RUN mv ./build/* /app/frontend/
WORKDIR /usr/src/app
COPY ./backend /usr/src/app
RUN mkdir /usr/src/media/
RUN mkdir /usr/src/logs/
# copy project
COPY ./backend/config/config.sample.py /usr/src/app/config/config.py
COPY ./data/db.sqlite3.base /usr/src/data/db.sqlite3
EXPOSE 34800
RUN python manage.py collectstatic
RUN sed -i -e "s/REPLACE_SECRET_KEY/$(od -x /dev/urandom | head -1 | awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}')/g" /usr/src/app/config/config.py