-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
79 lines (58 loc) · 1.8 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
FROM node:lts-alpine as nest-frontend
RUN mkdir /app
WORKDIR /app
# Required system packages
RUN apk add --update --no-cache git
COPY .nvmrc package.json package-lock.json /app/
RUN npm ci
# Copy application files
COPY tsconfig.json tsconfig.node.json vite.config.ts schema.json tailwind.config.js postcss.config.cjs /app/
COPY frontend /app/frontend/
RUN npm run build:production
# ----------------------------------------------------------
FROM python:3.11.1-slim as nest
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH /app/
# Add app user
RUN groupadd -r nest && useradd --create-home nest -g nest
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
bash-completion \
less \
lsof \
libpq-dev \
python3-dev \
vim \
curl \
postgresql \
gcc \
awscli \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip
RUN pip install --no-cache poetry==1.3.2
# Create app directory and required subdirectories
RUN mkdir -p /app/static
RUN chown -R nest:nest /app
# Set app user and working directory
USER nest
WORKDIR /app
ENV HOME=/app
COPY --chown=nest poetry.lock pyproject.toml poetry.toml manage.py .env.test /app/
RUN poetry install --no-root --only main --no-interaction --no-ansi
# Render needs a .ssh folder to make ssh tunneling work.
RUN mkdir ./.ssh && chmod 700 ./.ssh
# Remove unused apt packages
USER root
RUN apt-get purge -y gcc && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER nest
# Copy application files
COPY --chown=nest nest/ /app/nest/
COPY --chown=nest cli/ /app/cli/
COPY --chown=nest --from=nest-frontend /app/static/dist/ /app/static/dist/
ENV DJANGO_VITE_DEV_MODE=False
COPY --chown=nest docker-entrypoint.sh /app
RUN chmod +x docker-entrypoint.sh
ENTRYPOINT ["./docker-entrypoint.sh"]