# Scheer Enterprise Translation Tool — container image.
# No dependencies to install (server.js only uses Node's built-ins), so the
# image just needs a Node runtime plus the two app files.

FROM node:18-alpine

WORKDIR /app
COPY server.js index.html package.json ./

# DEEPL_API_KEY is passed at runtime (docker run -e / --env-file, or the
# Dokploy "Environment" tab), never baked into the image.
#
# domains.json holds which DeepL glossary_id belongs to which domain and
# direction. It must live on a mounted volume, otherwise every redeploy
# builds a fresh filesystem and the mappings are lost. /app/data is a
# subdirectory so mounting it does not shadow the app files in /app.
ENV PORT=3000
ENV DOMAINS_FILE=/app/data/domains.json
RUN mkdir -p /app/data
VOLUME ["/app/data"]

EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
  CMD wget -qO- http://127.0.0.1:3000/health || exit 1

CMD ["node", "server.js"]
