2023-06-23 04:08:00 +03:00
# Build
2026-04-21 02:25:29 +03:00
FROM --platform=$BUILDPLATFORM golang:1.24.6-bookworm@sha256:ab1d1823abb55a9504d2e3e003b75b36dbeb1cbcc4c92593d85a84ee46becc6c AS builder
2023-06-23 04:08:00 +03:00
WORKDIR /build
2026-04-21 02:25:29 +03:00
COPY go.mod go.sum ./
2023-06-23 04:08:00 +03:00
RUN go mod download
COPY . .
2026-04-21 02:25:29 +03:00
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED = 0 GOOS = ${ TARGETOS :- linux } GOARCH = ${ TARGETARCH :- amd64 } go build -trimpath -ldflags= "-s -w" -o /app/openserp .
2023-06-23 04:08:00 +03:00
2026-04-21 02:25:29 +03:00
# `chromedp/headless-shell:stable` also works here
2026-07-13 06:07:37 +03:00
FROM chromedp/headless-shell:stable@sha256:f7e7ac721b023cb8717f8108aef8b3e49995fb1e5a912f41e570c29e45d24961
2023-06-23 04:08:00 +03:00
2026-04-04 19:32:23 +03:00
WORKDIR /usr/src/app
2026-04-21 02:25:29 +03:00
# wget: used by HEALTHCHECK (localhost, no TLS, so ca-certificates not required).
# dumb-init: already provided by `docker run --init` / compose `init: true`, so we do NOT add tini here — the PID1 reaper is supplied by the runtime.
RUN apt-get update \
&& apt-get install -y --no-install-recommends wget \
&& rm -rf /var/lib/apt/lists/* \
&& getent passwd chrome >/dev/null 2>& 1 || useradd --create-home --uid 1001 --shell /bin/bash chrome \
&& chown chrome:chrome /usr/src/app
2023-06-23 04:08:00 +03:00
COPY --from= builder /app/openserp /usr/local/bin/openserp
2026-04-21 02:25:29 +03:00
COPY --chown= chrome:chrome config.yaml ./config.yaml
2023-06-23 04:08:00 +03:00
2026-04-21 02:25:29 +03:00
# Rod's launcher.LookPath does not know about /headless-shell/headless-shell.
# Viper auto-binds OPENSERP_APP_BROWSER_PATH to app.browser_path, so this pins the binary and avoids Rod's runtime chromium auto-download (which would fail in this non-root, network-restricted image).
ENV OPENSERP_APP_BROWSER_PATH = /headless-shell/headless-shell \
OPENSERP_SERVER_HOST = 0.0.0.0 \
OPENSERP_SERVER_PORT = 7000
2026-03-25 04:09:37 +03:00
2026-04-21 02:25:29 +03:00
USER chrome
HEALTHCHECK --interval= 30s --timeout= 5s --start-period= 15s --retries= 3 \
CMD wget --quiet --tries= 1 --spider " http://127.0.0.1: ${ OPENSERP_SERVER_PORT } /health " || exit 1
2023-06-23 04:08:00 +03:00
2026-04-21 02:25:29 +03:00
ENTRYPOINT [ "openserp" ]