-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
89 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
Makefile | ||
docker | ||
README.md | ||
docs | ||
.env | ||
|
@@ -8,4 +7,4 @@ docs | |
.idea | ||
node_modules | ||
nx | ||
.vscode | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,46 @@ | ||
FROM node:20 as production | ||
FROM ubuntu:22.04 | ||
|
||
ARG NODE_MAJOR=18 | ||
ARG NODE_ENV=production | ||
ENV NODE_ENV=${NODE_ENV} | ||
ENV TZ=UTC | ||
|
||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y ca-certificates curl gnupg supervisor | ||
RUN mkdir -p /etc/apt/keyrings | ||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | ||
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list | ||
RUN apt-get update | ||
RUN apt-get install nodejs -y | ||
RUN npm install -g npm | ||
RUN npm install -g yarn | ||
|
||
RUN apt-get install -y zip unzip supervisor libcap2-bin libpng-dev | ||
RUN apt-get -y autoremove | ||
RUN apt-get clean | ||
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
WORKDIR /app | ||
|
||
COPY package*.json ./ | ||
COPY ./package.json ./ | ||
|
||
RUN npm install -g yarn | ||
RUN yarn | ||
RUN yarn install --production=false | ||
RUN yarn global add nx | ||
|
||
COPY . . | ||
|
||
RUN nx repair | ||
|
||
RUN nx run api:build:production | ||
|
||
COPY ./docker/deployments/start-container /usr/local/bin/start-container | ||
COPY ./docker/deployments/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
RUN chmod +x /usr/local/bin/start-container | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["nx", "run", "api:production"] | ||
#ENTRYPOINT ["start-container"] | ||
ENTRYPOINT ["nx", "run", "api:serve"] | ||
#ENTRYPOINT ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[supervisord] | ||
nodaemon=true | ||
user=root | ||
logfile=/var/log/supervisor/supervisord.log | ||
pidfile=/var/run/supervisord.pid | ||
|
||
[program:api] | ||
command=node /app/dist/apps/api/src/main.js | ||
autostart=true | ||
autorestart=true | ||
startretries=5 | ||
numprocs=1 | ||
startsecs=0 | ||
process_name=%(program_name)s_%(process_num)02d | ||
stderr_logfile=/var/log/supervisor/%(program_name)s_stderr.log | ||
stderr_logfile_maxbytes=10MB | ||
stdout_logfile=/var/log/supervisor/%(program_name)s_stdout.log | ||
stdout_logfile_maxbytes=10MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters