Skip to content

Commit

Permalink
fix: pm2 config issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Volkov committed May 16, 2023
1 parent 7fdac90 commit 3d3c1fe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/nodejs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax docker/dockerfile:latest
ARG nodejs_version=18
ARG nodejs_version="18.16.0"
ARG os_version="bullseye-slim"
FROM node:${nodejs_version}-${os_version} AS build
LABEL org.opencontainers.image.authors="BN Enginseers" \
Expand All @@ -10,15 +10,15 @@ LABEL org.opencontainers.image.authors="BN Enginseers" \
org.opencontainers.image.source="https://github.com/bn-digital/docker" \
org.opencontainers.image.licenses="MIT"
ENV NODE_NO_WARNINGS="1" \
NODE_ENV=production
HOST="0.0.0.0" \
PORT="5000" \
NODE_ENV=production
WORKDIR /usr/local/src
RUN npm install --global pm2
USER node
EXPOSE $PORT
COPY --chown=node . .
ENTRYPOINT ["pm2-runtime"]
CMD ["--json", "process.yml"]
CMD ["ecosystem.config.yml"]

FROM build
10 changes: 10 additions & 0 deletions packages/nodejs/bin/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env node
const strapi = require("@strapi/strapi");
const fs = require("fs");
const path = require("path");

const uploadDir = path.join(process.cwd(), "public", "uploads");

fs.existsSync(uploadDir) || fs.mkdirSync(uploadDir, { recursive: true });

strapi().start();
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
apps:
- cwd: /usr/local/src
script: node_modules/@strapi/strapi/bin/strapi.js
args:
- start
script: bin/app.js
env:
STRAPI_DISABLE_UPDATE_NOTIFICATION: 'true'
STRAPI_HIDE_STARTUP_MESSAGE: 'true'
STRAPI_TELEMETRY_DISABLED: 'true'
BROWSER: 'false'
watch: false
instances: 1
source_map_support: true
exec_mode: cluster
name: app

0 comments on commit 3d3c1fe

Please sign in to comment.