Openstatus
www.openstatus.dev
1# syntax=docker/dockerfile:1.11
2# This file is generated by Dofigen v2.5.1
3# See https://github.com/lenra-io/dofigen
4
5# install
6FROM oven/bun@sha256:fbf8e67e9d3b806c86be7a2f2e9bae801f2d9212a21db4dcf8cc9889f5a3c9c4 AS install
7LABEL \
8 org.opencontainers.image.base.digest="sha256:fbf8e67e9d3b806c86be7a2f2e9bae801f2d9212a21db4dcf8cc9889f5a3c9c4" \
9 org.opencontainers.image.base.name="docker.io/oven/bun:1.3.3" \
10 org.opencontainers.image.stage="install"
11WORKDIR /app/
12RUN \
13 --mount=type=bind,target=bunfig.toml,source=bunfig.toml \
14 --mount=type=bind,target=package.json,source=package.json \
15 --mount=type=bind,target=apps/server/package.json,source=apps/server/package.json \
16 --mount=type=bind,target=packages/analytics/package.json,source=packages/analytics/package.json \
17 --mount=type=bind,target=packages/db/package.json,source=packages/db/package.json \
18 --mount=type=bind,target=packages/emails/package.json,source=packages/emails/package.json \
19 --mount=type=bind,target=packages/error/package.json,source=packages/error/package.json \
20 --mount=type=bind,target=packages/regions/package.json,source=packages/regions/package.json \
21 --mount=type=bind,target=packages/tinybird/package.json,source=packages/tinybird/package.json \
22 --mount=type=bind,target=packages/tracker/package.json,source=packages/tracker/package.json \
23 --mount=type=bind,target=packages/upstash/package.json,source=packages/upstash/package.json \
24 --mount=type=bind,target=packages/utils/package.json,source=packages/utils/package.json \
25 --mount=type=bind,target=packages/tsconfig/package.json,source=packages/tsconfig/package.json \
26 --mount=type=bind,target=packages/assertions/package.json,source=packages/assertions/package.json \
27 --mount=type=bind,target=packages/theme-store/package.json,source=packages/theme-store/package.json \
28 --mount=type=cache,target=/root/.bun/install/cache,sharing=locked \
29 bun install --production --frozen-lockfile --verbose
30
31# build
32FROM oven/bun@sha256:fbf8e67e9d3b806c86be7a2f2e9bae801f2d9212a21db4dcf8cc9889f5a3c9c4 AS build
33LABEL \
34 org.opencontainers.image.base.digest="sha256:fbf8e67e9d3b806c86be7a2f2e9bae801f2d9212a21db4dcf8cc9889f5a3c9c4" \
35 org.opencontainers.image.base.name="docker.io/oven/bun:1.3.3" \
36 org.opencontainers.image.stage="build"
37ENV NODE_ENV="production"
38WORKDIR /app/apps/server
39COPY \
40 --link \
41 "." "/app/"
42COPY \
43 --from=install \
44 --link \
45 "/app/node_modules" "/app/node_modules"
46RUN bun build --compile --sourcemap src/index.ts --outfile=app
47
48# runtime
49FROM debian@sha256:530a3348fc4b5734ffe1a137ddbcee6850154285251b53c3425c386ea8fac77b AS runtime
50LABEL \
51 io.dofigen.version="2.5.1" \
52 org.opencontainers.image.authors="OpenStatus Team" \
53 org.opencontainers.image.base.digest="sha256:530a3348fc4b5734ffe1a137ddbcee6850154285251b53c3425c386ea8fac77b" \
54 org.opencontainers.image.base.name="docker.io/debian:bullseye-slim" \
55 org.opencontainers.image.description="REST API server with Hono framework for OpenStatus" \
56 org.opencontainers.image.source="https://github.com/openstatusHQ/openstatus" \
57 org.opencontainers.image.title="OpenStatus Server" \
58 org.opencontainers.image.vendor="OpenStatus"
59COPY \
60 --from=build \
61 --chown=1000:1000 \
62 --chmod=555 \
63 --link \
64 "/app/apps/server/app" "/bin/"
65USER 0:0
66RUN <<EOF
67apt-get update
68apt-get install -y --no-install-recommends curl
69rm -rf /var/lib/apt/lists/*
70EOF
71USER 1000:1000
72EXPOSE 3000
73HEALTHCHECK \
74 --interval=30s \
75 --timeout=10s \
76 --start-period=30s \
77 --retries=3 \
78 CMD curl -f http://localhost:3000/ping || exit 1
79ENTRYPOINT ["/bin/app"]