Skip to content

Commit

Permalink
Merge pull request #17 from Inist-CNRS/build/update-backend-build
Browse files Browse the repository at this point in the history
Remove the compilation requirement to use full ts possibilities
  • Loading branch information
AlasDiablo authored Feb 23, 2024
2 parents 9e690a2 + c651919 commit e7066d8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 75 deletions.
24 changes: 4 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,11 @@ WORKDIR /app
COPY tdm-be/package*.json tdm-be/ts*.json /app/

# Install dependency
RUN npm ci
RUN npm ci --omit=dev

# Copy the back-end source code into the build container
COPY tdm-be /app/

# Build the Express app
RUN npm run build

#######################################################

# Stage 1 - Building Stage: Build back-end node modules
FROM node:18.19-bullseye-slim AS node-modules

# Switch to the main working directory
WORKDIR /app

# Copy package.json, package-lock.json and tsconfig.json files
COPY tdm-be/package*.json tdm-be/ts*.json /app/

# Install production dependency
RUN npm ci --omit=dev

#######################################################

# Stage 2 - Application Stage: Build the application image
Expand All @@ -73,10 +56,11 @@ WORKDIR /app
# Copy back-end files from the build container
COPY --chown=daemon:daemon --from=express-build /app/package.json /app/
COPY --chown=daemon:daemon --from=express-build /app/package-lock.json /app/
COPY --chown=daemon:daemon --from=node-modules /app/node_modules /app/node_modules/
COPY --chown=daemon:daemon --from=express-build /app/tsconfig.json /app/
COPY --chown=daemon:daemon --from=express-build /app/node_modules /app/node_modules/
COPY --chown=daemon:daemon --from=express-build /app/config/default.json /app/config/
COPY --chown=daemon:daemon --from=express-build /app/config/production.json /app/config/
COPY --chown=daemon:daemon --from=express-build /app/dist /app/
COPY --chown=daemon:daemon --from=express-build /app/src /app/src

# Copy front-end files from the build container
COPY --chown=daemon:daemon --from=react-build /app/.next /app/public/_next/
Expand Down
4 changes: 0 additions & 4 deletions tdm-be/Dockerfile

This file was deleted.

51 changes: 14 additions & 37 deletions tdm-be/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions tdm-be/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"name": "tdm-be",
"version": "1.0.0",
"description": "",
"private": true,
"main": "index.js",
"engines": {
"node": "18"
},
"scripts": {
"dev": "nodemon src/app.ts",
"start": "node app.js",
"build": "tsc",
"start": "ts-node --transpile-only ./src/app.ts",
"swagger-autogen": "ts-node --project tsconfig.dev.json bin/swagger.ts 3000"
},
"keywords": [],
Expand All @@ -29,6 +25,9 @@
"nodemailer": "^6.9.9",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.0",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2",
"winston": "^3.11.0"
},
"devDependencies": {
Expand All @@ -45,9 +44,6 @@
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.6",
"eslint": "^8.56.0",
"nodemon": "^3.0.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
"nodemon": "^3.0.3"
}
}
4 changes: 2 additions & 2 deletions tdm-be/tsconfig.dev.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"target": "ES2022",
"moduleResolution": "Node",
"lib": [
"ESNext"
],
Expand Down
5 changes: 2 additions & 3 deletions tdm-be/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"require": ["tsconfig-paths/register"]
},
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"target": "ES2022",
"moduleResolution": "Node",
"lib": [
"ESNext"
],
"outDir": "dist",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
Expand Down

0 comments on commit e7066d8

Please sign in to comment.