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