-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f75626
commit df36511
Showing
9 changed files
with
2,320 additions
and
544 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,7 @@ readme.md | |
#deps def | ||
package-lock.json | ||
|
||
.tap/ | ||
.dockerignore | ||
Dockerfile | ||
Dockerfile | ||
config.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
global-style=true | ||
install-strategy=shallow | ||
engine-strict=true | ||
legacy-peer-deps=true | ||
lockfile-version=3 | ||
|
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,51 +1,46 @@ | ||
# ---- Build ---- | ||
FROM groupclaes/npm AS build | ||
FROM --platform=linux/amd64 groupclaes/npm AS build | ||
|
||
# change the working directory to new exclusive app folder | ||
WORKDIR /usr/src/app | ||
|
||
# copy package file | ||
COPY package.json ./ | ||
# copy project file | ||
COPY ./ ./ | ||
|
||
# install node packages | ||
RUN npm i | ||
|
||
USER root | ||
RUN npm install esbuild --global | ||
RUN npm install | ||
|
||
# copy project | ||
COPY src/ ./ | ||
|
||
# build project | ||
# create esbuild package | ||
RUN esbuild ./index.ts --bundle --platform=node --minify --packages=external --external:'./config' --outfile=index.min.js | ||
|
||
# ---- Build ---- | ||
FROM groupclaes/npm AS deps | ||
|
||
# ---- Deps ---- | ||
FROM --platform=linux/amd64 groupclaes/npm AS depedencies | ||
|
||
# change the working directory to new exclusive app folder | ||
WORKDIR /usr/src/app | ||
|
||
# set current user to node | ||
USER node | ||
|
||
# copy package file | ||
COPY package.json ./ | ||
|
||
# install node packages | ||
RUN npm i | ||
RUN npm install | ||
|
||
# from base image node | ||
FROM groupclaes/node AS release | ||
|
||
# --- release --- | ||
FROM --platform=linux/amd64 groupclaes/node AS release | ||
|
||
# set current user to node | ||
USER node | ||
|
||
# change the working directory to new exclusive app folder | ||
WORKDIR /usr/src/app | ||
|
||
# copy file and packages from build | ||
COPY --from=build /usr/src/app/index.min.js ./index.js | ||
COPY --from=deps /usr/src/app/node_modules/ ./node_modules | ||
# copy dependencies | ||
COPY --chown=node:node --from=depedencies /usr/src/app ./ | ||
|
||
# copy project file | ||
COPY --chown=node:node --from=build /usr/src/app/index.min.js ./ | ||
|
||
# command to run when intantiate an image | ||
CMD ["node","index.js"] | ||
CMD ["node","index.min.js"] |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
import server from './src' | ||
const cfg = require('./config') | ||
|
||
const main = async function () { | ||
const fastify = await server(cfg); | ||
|
||
['SIGTERM', 'SIGINT'].forEach(signal => { | ||
process.on(signal, async () => { | ||
await fastify?.close() | ||
process.exit(0) | ||
}) | ||
}) | ||
} | ||
|
||
main() |
Oops, something went wrong.