Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoBackendAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
Backend
DojoBackendAPI
Commits
7e74f44d
Commit
7e74f44d
authored
2 years ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
Dockerfile => Remove database migration stage and integrate it in the run
parent
a4b5aa5e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dockerfile_ExpressAPI
+6
-25
6 additions, 25 deletions
Dockerfile_ExpressAPI
ExpressAPI/package.json
+9
-8
9 additions, 8 deletions
ExpressAPI/package.json
ExpressAPI/tsconfig.json
+2
-1
2 additions, 1 deletion
ExpressAPI/tsconfig.json
with
17 additions
and
34 deletions
Dockerfile_ExpressAPI
+
6
−
25
View file @
7e74f44d
...
@@ -2,7 +2,6 @@ ARG BUILD_WORKDIR=/dojo/ExpressAPI
...
@@ -2,7 +2,6 @@ ARG BUILD_WORKDIR=/dojo/ExpressAPI
######################################################################## Build stage
######################################################################## Build stage
FROM node:20-bullseye AS builder
FROM node:20-bullseye AS builder
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
...
@@ -24,24 +23,6 @@ RUN npm run build
...
@@ -24,24 +23,6 @@ RUN npm run build
######################################################################## Database migration stage
FROM node:20-bullseye AS database-migration
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
LABEL Description="Express API for Dojo - Database migration stage"
ARG BUILD_WORKDIR
COPY --from=builder ${BUILD_WORKDIR}/ ${BUILD_WORKDIR}/
WORKDIR ${BUILD_WORKDIR}
# Database migration
RUN npm run database:deploy
######################################################################## Run stage
######################################################################## Run stage
FROM node:20-bullseye
FROM node:20-bullseye
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
...
@@ -49,13 +30,13 @@ LABEL Description="Express API for Dojo - Run stage"
...
@@ -49,13 +30,13 @@ LABEL Description="Express API for Dojo - Run stage"
ARG BUILD_WORKDIR
ARG BUILD_WORKDIR
COPY --from=
database-migration
${BUILD_WORKDIR}/node_modules ./node_modules
COPY --from=
builder
${BUILD_WORKDIR}/node_modules ./node_modules
COPY --from=
database-migration
${BUILD_WORKDIR}/package*.json ./
COPY --from=
builder
${BUILD_WORKDIR}/package*.json ./
COPY --from=
database-migration
${BUILD_WORKDIR}/dist ./dist
COPY --from=
builder
${BUILD_WORKDIR}/dist ./dist
COPY --from=
database-migration
${BUILD_WORKDIR}/prisma ./prisma
COPY --from=
builder
${BUILD_WORKDIR}/prisma ./prisma
COPY --from=
database-migration
${BUILD_WORKDIR}/.env ./.env
COPY --from=
builder
${BUILD_WORKDIR}/.env ./.env
EXPOSE 30992
EXPOSE 30992
CMD [ "npm", "run", "start:prod" ]
CMD [ "npm", "run", "start:
migrate:
prod" ]
#ENTRYPOINT ["tail", "-f", "/dev/null"]
#ENTRYPOINT ["tail", "-f", "/dev/null"]
This diff is collapsed.
Click to expand it.
ExpressAPI/package.json
+
9
−
8
View file @
7e74f44d
...
@@ -12,10 +12,11 @@
...
@@ -12,10 +12,11 @@
"database:seed"
:
"npx prisma db seed"
,
"database:seed"
:
"npx prisma db seed"
,
"database:deploy"
:
"npm run database:migrate && npm run database:seed"
,
"database:deploy"
:
"npm run database:migrate && npm run database:seed"
,
"start:dev"
:
"npx nodemon src/app.ts"
,
"start:dev"
:
"npx nodemon src/app.ts"
,
"start:prod"
:
"NODE_ENV=production npx node --max-http-header-size=1048576 dist/app.js"
"start:prod"
:
"NODE_ENV=production npx node --max-http-header-size=1048576 dist/app.js"
,
"start:migrate:prod"
:
"npm run database:deploy && npm run start:prod"
},
},
"prisma"
:
{
"prisma"
:
{
"seed"
:
"
ts-
node prisma/seed
.ts
"
"seed"
:
"node
dist/
prisma/seed"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@prisma/client"
:
"^4.16.2"
,
"@prisma/client"
:
"^4.16.2"
,
...
...
This diff is collapsed.
Click to expand it.
ExpressAPI/tsconfig.json
+
2
−
1
View file @
7e74f44d
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
}
}
},
},
"include"
:
[
"include"
:
[
"src/**/*"
"src/**/*"
,
"prisma/seed.ts"
],
],
"exclude"
:
[
"exclude"
:
[
]
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment