-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (44 loc) · 2.1 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
# All-in-one container for Repochat
FROM ubuntu:22.04
ARG NODE_ENV production
RUN apt-get update && apt-get install -y \
curl gnupg build-essential libmagic1 \
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -y nginx nodejs python3 python3-pip \
&& npm install -g npm pnpm \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Verify installations
RUN node --version && npm --version && pnpm --version
RUN mkdir -p /usr/app/api
RUN mkdir -p /usr/app/app
WORKDIR /usr/app
# Installing action utils dependencies
COPY package-lock.json package.json /usr/app/
RUN npm i -g [email protected] && npm ci
# Installing app dependencies
COPY ./app/package-lock.json ./app/package.json /usr/app/app/
RUN cd /usr/app/app && npm ci
# Installing api dependencies
COPY ./api/requirements.txt /usr/app/api
RUN python3 -m pip install -r /usr/app/api/requirements.txt --no-cache-dir
COPY ./app /usr/app/app
COPY ./api /usr/app/api
COPY ./app/next-env.d.ts ./app/next.config.js ./app/package.json ./app/postcss.config.js ./app/tailwind.config.js ./app/tsconfig.json /usr/app/
RUN cd ./app && pnpm exec next telemetry disable && pnpm run build
# NGINX configuration for a single endpoint
RUN echo "events { worker_connections 1024; }" > /etc/nginx/nginx.conf && \
echo "http {" >> /etc/nginx/nginx.conf && \
echo " server {" >> /etc/nginx/nginx.conf && \
echo " listen 80 default_server;" >> /etc/nginx/nginx.conf && \
echo " server_name _;" >> /etc/nginx/nginx.conf && \
echo " location / {" >> /etc/nginx/nginx.conf && \
echo " proxy_pass http://127.0.0.1:3000;" >> /etc/nginx/nginx.conf && \
echo " }" >> /etc/nginx/nginx.conf && \
echo " location /api {" >> /etc/nginx/nginx.conf && \
echo " proxy_pass http://127.0.0.1:5328;" >> /etc/nginx/nginx.conf && \
echo " }" >> /etc/nginx/nginx.conf && \
echo " }" >> /etc/nginx/nginx.conf && \
echo "}" >> /etc/nginx/nginx.conf
COPY ./Makefile /usr/app/Makefile
ENTRYPOINT [ "sh", "-c", "service nginx start && make prod-docker" ]