diff options
| author | Ritesh Ghosh <[email protected]> | 2023-08-19 22:47:35 +0530 |
|---|---|---|
| committer | Ritesh Ghosh <[email protected]> | 2023-08-19 22:47:35 +0530 |
| commit | a8da9745229c40fb7ca77a719f9da9809228bedf (patch) | |
| tree | 7b59df1d235901691a56da67b8864736d2da3817 /Dockerfile | |
| parent | ace29d6c2bdbdb756ae2ed674e0e817f0aa0be5e (diff) | |
| download | aniwatch-api-a8da9745229c40fb7ca77a719f9da9809228bedf.tar.xz aniwatch-api-a8da9745229c40fb7ca77a719f9da9809228bedf.zip | |
feat(docker): added `Dockerfile` file
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e99d431 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM node:18-alpine + +LABEL description="Aniwatch API docker image" +LABEL org.opencontainers.image.source https://github.com/ghoshRitesh12/aniwatch-api + +# create a non-privileged user +RUN addgroup -S aniwatch && adduser -S zoro -G aniwatch + +# set secure folder permissions +RUN mkdir /app && chown -R zoro:aniwatch /app + +# set non-privileged user +USER zoro + +# set working directory +WORKDIR /app + +# copy config file for better use of layers +COPY --chown=zoro:aniwatch package.json . + +# install dependencies +RUN npm install --omit=dev --ignore-scripts + +# copy all necessary files in the container (except ones in .dockerignore) +COPY --chown=zoro:aniwatch . . + +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s CMD [ "npm", "run", "healthcheck" ] + +ENV NODE_ENV=production +ENV PORT=4000 + +# exposed port +EXPOSE 4000 + +CMD [ "node", "dist/server.js" ] |
