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
8901bf22
Commit
8901bf22
authored
2 years ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
Dockerfile => Add stage for database migration
parent
42f508ca
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Dockerfile_ExpressAPI
+24
-2
24 additions, 2 deletions
Dockerfile_ExpressAPI
ExpressAPI/package.json
+7
-5
7 additions, 5 deletions
ExpressAPI/package.json
with
31 additions
and
7 deletions
Dockerfile_ExpressAPI
+
24
−
2
View file @
8901bf22
ARG BUILD_WORKDIR=/dojo/ExpressAPI
######################################################################## Build stage
FROM node:20-bullseye AS builder
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
...
...
@@ -9,6 +12,7 @@ ARG BUILD_WORKDIR
# Create app directory
ADD ExpressAPI/ ${BUILD_WORKDIR}/
ADD .env ${BUILD_WORKDIR}/.env
WORKDIR ${BUILD_WORKDIR}
...
...
@@ -20,6 +24,24 @@ 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
FROM node:20-bullseye
LABEL maintainer="Michaël Minelli <michael-jean.minelli@hesge.ch>"
...
...
@@ -31,9 +53,9 @@ COPY --from=builder ${BUILD_WORKDIR}/node_modules ./node_modules
COPY --from=builder ${BUILD_WORKDIR}/package*.json ./
COPY --from=builder ${BUILD_WORKDIR}/dist ./dist
COPY --from=builder ${BUILD_WORKDIR}/prisma ./prisma
ADD
.env ./.env
COPY --from=builder ${BUILD_WORKDIR}/
.env ./.env
EXPOSE 30992
CMD [ "npm", "run", "start:
migrate:
prod" ]
CMD [ "npm", "run", "start:prod" ]
#ENTRYPOINT ["tail", "-f", "/dev/null"]
This diff is collapsed.
Click to expand it.
ExpressAPI/package.json
+
7
−
5
View file @
8901bf22
...
...
@@ -7,10 +7,12 @@
"main"
:
"app.js"
,
"scripts"
:
{
"clean"
:
"rm -R dist/*"
,
"build"
:
"npx prisma generate; npx tsc --project ./"
,
"build"
:
"npx prisma generate && npx tsc --project ./"
,
"database:migrate"
:
"npx prisma migrate deploy"
,
"database:seed"
:
"npx prisma db seed"
,
"database:deploy"
:
"npm run database:migrate && npm run database:seed"
,
"start:dev"
:
"npx nodemon src/app.ts"
,
"start:prod"
:
"NODE_ENV=production npx node --max-http-header-size=1048576 dist/app.js"
,
"start:migrate:prod"
:
"npx prisma migrate deploy && npx prisma db seed && npm run start:prod"
"start:prod"
:
"NODE_ENV=production npx node --max-http-header-size=1048576 dist/app.js"
},
"prisma"
:
{
"seed"
:
"ts-node prisma/seed.ts"
...
...
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