irongit

Django + Next + Postgres + Docker + Nginx

djext/Dockerfile
46 lines985 B
1FROM alpine:3.17
2
3# install node, python, postgres, and nginx
4RUN apk add --no-cache postgresql
5RUN apk add --no-cache nodejs
6RUN apk add --no-cache python3
7RUN apk add --no-cache nginx
8RUN apk add --no-cache py3-pip
9RUN apk add --no-cache npm
10
11# configure postgres
12RUN mkdir -p /run/postgresql
13RUN chown -R postgres:postgres /run/postgresql
14
15# configure nginx
16RUN mkdir -p /run/nginx
17RUN chown -R nginx:nginx /run/nginx
18
19# install node dependencies
20COPY ./frontend/package.json /frontend/package.json
21WORKDIR /frontend
22RUN npm install
23
24# install python dependencies
25COPY ./backend/requirements.txt /backend/requirements.txt
26WORKDIR /backend
27RUN pip install -r requirements.txt
28
29# configure node
30COPY ./frontend /frontend
31WORKDIR /frontend
32RUN npm run build
33
34# configure django
35ENV IS_DOCKER=1
36ENV PYTHONDONTWRITEBYTECODE=1
37ENV PYTHONUNBUFFERED=1
38COPY ./backend /backend
39
40# copy files
41COPY ./backend /backend
42
43WORKDIR /
44COPY ./docker-entrypoint.sh /
45
46CMD ["sh", "docker-entrypoint.sh"]