-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use production level docker settings (#26)
Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
442 additions
and
21 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
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
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 |
---|---|---|
|
@@ -133,3 +133,4 @@ build | |
/playwright-report/ | ||
/playwright/.cache/ | ||
screenshots | ||
.envrc |
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,14 +1,40 @@ | ||
FROM node:20-slim | ||
FROM node:20-slim as builder | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y build-essential cmake git libssl-dev | ||
RUN apt-get install -y build-essential cmake git libssl-dev tini | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
COPY package*.json ./ | ||
|
||
RUN npm ci --quiet | ||
|
||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
RUN npm prune --omit=dev | ||
|
||
FROM node:20-slim as app | ||
ENV NODE_ENV production | ||
WORKDIR /app | ||
# built src without dev dependencies | ||
COPY --from=builder /app ./ | ||
# tini is used to handle signals properly, see https://github.com/krallin/tini#using-tini | ||
COPY --from=builder /usr/bin/tini /usr/bin/tini | ||
|
||
# copy shared libraries (without having artifacts from apt-get install that is needed to build our application) | ||
COPY --from=builder /usr/lib/**/libcrypto* /usr/lib/ | ||
COPY --from=builder /usr/lib/**/libssl* /usr/lib/ | ||
|
||
HEALTHCHECK --interval=12s --timeout=12s --start-period=10s CMD npm run healthcheck | ||
|
||
CMD [ "npm", "start" ] | ||
# Use tini to handle signals properly, see https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals | ||
ENTRYPOINT ["/usr/bin/tini", "-p", "SIGKILL", "--"] | ||
|
||
CMD [ "node", "dist/src/index.js" ] | ||
|
||
# for best practices, see: | ||
# * https://snyk.io/blog/10-best-practices-to-containerize-nodejs-web-applications-with-docker/ | ||
# * https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md | ||
# * https://nodejs.org/en/docs/guides/nodejs-docker-webapp |
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
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,10 +1,10 @@ | ||
version: "3.8" | ||
|
||
services: | ||
server: | ||
helia-http-gateway: | ||
build: . | ||
restart: always | ||
ports: | ||
- "8080:8080" | ||
- "${PORT:-8080}:8080" | ||
environment: | ||
- DEBUG="helia-server*" | ||
- DEBUG="${DEBUG:-helia-http-gateway*}" |
Oops, something went wrong.