From 5e7771c4ac79384515c6a3457d1f1884e8433895 Mon Sep 17 00:00:00 2001 From: Paul Munteanu Date: Sat, 29 May 2021 21:35:39 +0300 Subject: [PATCH 1/4] Compile TS during Docker image build --- Dockerfile | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1113978f..39986e72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ FROM node:lts-alpine WORKDIR /usr/src/fosscord-api -COPY package.json . +COPY package.json . RUN npm install RUN npx patch-package COPY . . EXPOSE 3001 +RUN npm run build CMD ["npm", "start"] \ No newline at end of file diff --git a/package.json b/package.json index 0f651646..a3160391 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "test": "jest", "test:watch": "jest --watch", - "start": "npm run build && node dist/start", + "start": "node dist/start", "build": "tsc -b .", "dev": "tsnd --respawn src/start.ts" }, From 04c5e490d58a8235be3f257c7e0362e6e81cdcfd Mon Sep 17 00:00:00 2001 From: Paul Munteanu Date: Sat, 29 May 2021 22:26:45 +0300 Subject: [PATCH 2/4] Build on start for the CONTRIBUTORS --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a3160391..0f651646 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "test": "jest", "test:watch": "jest --watch", - "start": "node dist/start", + "start": "npm run build && node dist/start", "build": "tsc -b .", "dev": "tsnd --respawn src/start.ts" }, From fbfe757c9eb481a278489d8ffbd1d24a0b441ac4 Mon Sep 17 00:00:00 2001 From: Paul Munteanu Date: Sat, 29 May 2021 22:33:31 +0300 Subject: [PATCH 3/4] Dockerfile: run app instead of recompiling --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 39986e72..66cd6897 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,4 @@ RUN npx patch-package COPY . . EXPOSE 3001 RUN npm run build -CMD ["npm", "start"] \ No newline at end of file +CMD ["node", "dist/start.js"] \ No newline at end of file From 20cbccf6cff9b018a2791e11020dc5c9e0fcb435 Mon Sep 17 00:00:00 2001 From: Paul Munteanu Date: Sat, 29 May 2021 22:36:41 +0300 Subject: [PATCH 4/4] Remove obsolete npx patch-package command --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 66cd6897..4cdb93e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM node:lts-alpine WORKDIR /usr/src/fosscord-api COPY package.json . RUN npm install -RUN npx patch-package COPY . . EXPOSE 3001 RUN npm run build