Skip to content

Commit

Permalink
Merge branch 'release/1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenkii committed Dec 25, 2023
2 parents c3d6965 + 53da69e commit 6e64bec
Show file tree
Hide file tree
Showing 18 changed files with 882 additions and 114 deletions.
44 changes: 38 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ### Base image ###
# ################################################################

FROM node:alpine as base
FROM node:18-alpine as base

WORKDIR /opt

Expand All @@ -11,14 +11,46 @@ COPY . .
ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}

RUN apk update && \
apk upgrade && \
npm i npm@next-10 -g && \
chown node:node -R /opt

COPY --chown=node:node package*.json ./

USER node

# ################################################################
# ### development image ###
# ### build image ###
# ################################################################

FROM base as development
FROM base as build

WORKDIR /opt
ENV NODE_ENV development

COPY --chown=node:node . .

RUN npm install && npm cache clean --force
ENV PATH /opt/node_modules/.bin:$PATH

RUN tsc -p ./tsconfig.json && \
resolve-tspaths --out "dist"

# ################################################################
# ### modules image ###
# ################################################################

FROM base as modules

RUN npm install && npm cache clean --force

# ################################################################
# ### production image ###
# ################################################################

FROM base as production

RUN npm install --quiet --unsafe-perm --no-progress --no-audit --include=dev
COPY --from=build --chown=node:node /opt/dist ./dist
COPY --from=modules --chown=node:node /opt/node_modules ./node_modules

CMD npm run start
CMD node dist/backend/app.js
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ services:
build:
context: .
dockerfile: ./Dockerfile
target: development
target: build
args:
- NODE_ENV=development
command: npm run dev
ports:
- '9229:9229/tcp'
volumes:
Expand All @@ -22,4 +23,5 @@ services:
- WELCOME_CHANNEL_ID
- MONGO_ENABLE_SSL
- MONGO_ENABLE_SSL_VALIDATION
- API_PORT
- API_PORT
- HP_TOKEN
Loading

0 comments on commit 6e64bec

Please sign in to comment.