Skip to content

Commit

Permalink
feat: add healthcheck to echoserver container image
Browse files Browse the repository at this point in the history
The integration tests need the echoserver to be healthy before starting,
to avoid failing due to the server not listening.

This bumps the echoserver version to 0.3.0.
  • Loading branch information
h4l committed Dec 29, 2024
1 parent 27fbf53 commit ef36b37
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
11 changes: 10 additions & 1 deletion testing/v8serialize-echo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ARG DENO_VERSION NODE_VERSION DNT_NODE_VERSION DNT_DENO_VERSION

FROM denoland/deno:${DENO_VERSION:-alpine} AS echoserver-deno

RUN apk add --no-cache curl
COPY main.ts .
USER deno

Expand All @@ -15,6 +16,10 @@ EXPOSE 8000

CMD ["run", "--no-remote", "--allow-net", "--allow-env", "main.ts"]

HEALTHCHECK --start-period=20s --start-interval=1s \
CMD curl --fail --silent --show-error -o /dev/null \
"http://localhost:${V8SERIALIZE_PORT:?}/?healthcheck"


FROM denoland/deno:bin-${DNT_DENO_VERSION:-latest} AS dnt-deno

Expand All @@ -33,7 +38,7 @@ RUN npm pack ./npm
FROM node:${NODE_VERSION:-alpine} AS echoserver-node
ARG ECHOSERVER_VERSION

RUN apk add --no-cache tini
RUN apk add --no-cache tini curl
WORKDIR /app

RUN --mount=from=npm-package,source=/build/,target=/build/ \
Expand All @@ -50,3 +55,7 @@ USER node

ENTRYPOINT ["/sbin/tini", "--", "docker-entrypoint.sh"]
CMD ["-e", "require('v8serialize-echoserver').main()"]

HEALTHCHECK --start-period=20s --start-interval=1s \
CMD curl --fail --silent --show-error -o /dev/null \
"http://localhost:${V8SERIALIZE_PORT:?}/?healthcheck"
1 change: 0 additions & 1 deletion testing/v8serialize-echo/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ECHOSERVER_VERSION = "0.1.0"
DNT_NODE_VERSION = "22"
DNT_DENO_VERSION = "1.46.1"

Expand Down
2 changes: 1 addition & 1 deletion testing/v8serialize-echo/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import consumers from "node:stream/consumers";
import { inspect } from "node:util";
import v8 from "node:v8";

export const ECHOSERVER_VERSION = "0.2.0";
export const ECHOSERVER_VERSION = "0.3.0";

function parseSettings() {
const logWithColor: boolean = env.V8SERIALIZE_LOG_WITH_COLOR === "true";
Expand Down

0 comments on commit ef36b37

Please sign in to comment.