-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deploy): add docker recipes to deploy
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM node:18-alpine AS build-image | ||
|
||
WORKDIR /app | ||
|
||
# For PG Native build | ||
RUN apk --no-cache add make python3 gcc postgresql-dev g++ | ||
|
||
COPY package.json package-lock.json* ./ | ||
|
||
# **IMPORTANT**: Replace this line per | ||
# `npm ci` in your own deployments | ||
# For it to work in the `whook` monorepos, | ||
# had to remove the c | ||
RUN npm i | ||
|
||
ARG NODE_ENV=production | ||
ENV NODE_ENV=$NODE_ENV | ||
|
||
ARG APP_ENV=production | ||
ENV APP_ENV=$APP_ENV | ||
|
||
ARG DEV_MODE=0 | ||
ENV DEV_MODE=$DEV_MODE | ||
|
||
COPY ./bin /app/bin | ||
COPY ./src /app/src | ||
COPY ./tsconfig.json /app/tsconfig.json | ||
RUN npm run build | ||
RUN npm ci --production && npm cache clean --force | ||
|
||
FROM node:18-alpine | ||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json* ./ | ||
|
||
COPY --from=build-image /app/node_modules /app/node_modules | ||
COPY --from=build-image /app/dist /app/dist | ||
COPY --from=build-image /app/builds /app/builds | ||
COPY --from=build-image /app/bin /app/bin | ||
|
||
ARG NODE_ENV=production | ||
ENV NODE_ENV=$NODE_ENV | ||
|
||
ARG APP_ENV=production | ||
ENV APP_ENV=$APP_ENV | ||
|
||
ARG HOST=0.0.0.0 | ||
ENV HOST=$HOST | ||
ARG PORT=8000 | ||
ENV PORT=$PORT | ||
|
||
ENV MAIN_FILE builds/${APP_ENV}/start.js | ||
|
||
EXPOSE ${PORT} | ||
|
||
CMD node ${MAIN_FILE} |
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