domains.json was written next to server.js, i.e. into the image filesystem, so every redeploy discarded the domain -> glossary_id mappings. Its path is now overridable via DOMAINS_FILE and the image defaults it to /app/data, a subdirectory so that mounting a volume there does not shadow server.js and index.html in /app. Also adds a GET /health endpoint plus a Docker HEALTHCHECK that uses it. The probe deliberately does not call DeepL, so an upstream DeepL outage does not get the container restarted. .gitignore is new; .env holds a real API key and was previously untracked only by convention. Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
953 B
Docker
28 lines
953 B
Docker
# 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"]
|