forked from fga-eps-mds/2024.1-CALCULUS-UserService
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fga-eps-mds/2024.2-ARANDU-DOC#42): modifies docker configuration …
…and its files
- Loading branch information
1 parent
04fae21
commit 99bb629
Showing
9 changed files
with
123 additions
and
39 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
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,14 @@ | ||
MONGODB_URI= | ||
EMAIL_USER= | ||
EMAIL_PASS= | ||
SENDGRID_API_KEY= | ||
JWT_SECRET= | ||
JWT_EXPIRATION= | ||
GOOGLE_CLIENT_ID= | ||
GOOGLE_CLIENT_SECRET= | ||
GOOGLE_CALLBACK_URL= | ||
MICROSOFT_CLIENT_ID= | ||
MICROSOFT_CLIENT_SECRET= | ||
MICROSOFT_TENANT_ID= | ||
MICROSOFT_CALLBACK_URL= | ||
FRONTEND_URL= |
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,14 @@ | ||
MONGODB_URI= | ||
EMAIL_USER= | ||
EMAIL_PASS= | ||
SENDGRID_API_KEY= | ||
JWT_SECRET= | ||
JWT_EXPIRATION= | ||
GOOGLE_CLIENT_ID= | ||
GOOGLE_CLIENT_SECRET= | ||
GOOGLE_CALLBACK_URL= | ||
MICROSOFT_CLIENT_ID= | ||
MICROSOFT_CLIENT_SECRET= | ||
MICROSOFT_TENANT_ID= | ||
MICROSOFT_CALLBACK_URL= | ||
FRONTEND_URL= |
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,14 +1,38 @@ | ||
FROM node:22-alpine | ||
|
||
WORKDIR /app | ||
FROM node:22-alpine AS base | ||
|
||
FROM base AS deps | ||
RUN apk add --no-cache libc6-compat | ||
|
||
COPY package*.json ./ | ||
WORKDIR /app | ||
|
||
RUN npm install | ||
COPY package.json package-lock.json* ./ | ||
RUN \ | ||
if [ -f package-lock.json ]; then npm ci; \ | ||
fi | ||
|
||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
COPY .env .env | ||
RUN npm run build | ||
|
||
CMD ["npm", "run", "start:dev"] | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
|
||
RUN addgroup -g 1001 -S nodejs \ | ||
&& adduser -S arandu -u 1001 | ||
|
||
COPY --chown=arandu:nodejs --from=builder /app/dist ./dist | ||
COPY --chown=arandu:nodejs --from=builder /app/node_modules ./node_modules | ||
|
||
USER arandu | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT=3000 | ||
|
||
CMD ["node", "dist/main.js"] |
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,38 @@ | ||
FROM node:22-alpine AS base | ||
|
||
FROM base AS deps | ||
RUN apk add --no-cache libc6-compat | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json* ./ | ||
RUN \ | ||
if [ -f package-lock.json ]; then npm ci; \ | ||
fi | ||
|
||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
COPY .env.prod.template .env | ||
RUN npm run build | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
|
||
RUN addgroup -g 1001 -S nodejs \ | ||
&& adduser -S arandu -u 1001 | ||
|
||
COPY --chown=arandu:nodejs --from=builder /app/dist ./dist | ||
COPY --chown=arandu:nodejs --from=builder /app/node_modules ./node_modules | ||
|
||
USER arandu | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT=3000 | ||
|
||
CMD ["node", "dist/main.js"] |
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,15 @@ | ||
.PHONY: build | ||
build: | ||
docker compose build | ||
|
||
.PHONY: start | ||
start: | ||
docker compose up | ||
|
||
.PHONY: run | ||
run: | ||
docker compose up --build | ||
|
||
.PHONY: stop | ||
stop: | ||
docker compose down |
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