Initial commit: Dockerfile, docker-compose.yml, .env.example
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
afc1c09745
4 files changed
+92
No files matched your search
@@ -0,0 +1,6 @@
|
||||
# cp .env.example .env
|
||||
DOPBASE_REF=main
|
||||
DOPBASE_PORT=8840
|
||||
DOPBASE_PUBLIC_URL=http://localhost:8840
|
||||
# DOPBASE_ROOT_EMAIL=admin@example.com
|
||||
# DOPBASE_TRUSTED_PROXIES=172.16.0.0/12
|
||||
@@ -0,0 +1 @@
|
||||
.env
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
# Dopbase : build depuis les sources (le depot n'a pas de Dockerfile de prod).
|
||||
# Etapes : clone -> UI Vue (bun) -> binaire Rust (UI embarquee) -> image runtime.
|
||||
|
||||
ARG DOPBASE_REF=main
|
||||
|
||||
# --- 1. Sources -------------------------------------------------------------
|
||||
FROM alpine/git AS src
|
||||
ARG DOPBASE_REF
|
||||
RUN git clone --depth 1 --branch "${DOPBASE_REF}" https://github.com/dopbase/dopbase.git /workspace
|
||||
|
||||
# --- 2. Admin UI (Vite) -----------------------------------------------------
|
||||
FROM oven/bun:1 AS admin-ui
|
||||
WORKDIR /workspace
|
||||
COPY --from=src /workspace/package.json /workspace/bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
COPY --from=src /workspace/index.html /workspace/vite.config.ts /workspace/eslint.config.js ./
|
||||
COPY --from=src /workspace/tsconfig*.json ./
|
||||
COPY --from=src /workspace/config ./config
|
||||
COPY --from=src /workspace/public ./public
|
||||
COPY --from=src /workspace/src ./src
|
||||
RUN bun run build:ui
|
||||
|
||||
# --- 3. Binaire Rust (reprend la disposition de app/Dockerfile.test) --------
|
||||
FROM rust:1.98-bookworm AS builder
|
||||
WORKDIR /workspace
|
||||
COPY --from=src /workspace/app/Cargo.toml /workspace/app/Cargo.lock /workspace/app/build.rs ./app/
|
||||
COPY --from=src /workspace/app/src ./app/src
|
||||
COPY --from=src /workspace/app/migrations ./app/migrations
|
||||
COPY --from=admin-ui /workspace/dist ./dist
|
||||
RUN cargo build --manifest-path app/Cargo.toml --release --locked
|
||||
|
||||
# --- 4. Runtime -------------------------------------------------------------
|
||||
FROM debian:bookworm-slim
|
||||
RUN apt-get update \
|
||||
&& apt-get install --yes --no-install-recommends ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& useradd --system --uid 10001 --home-dir /data --shell /usr/sbin/nologin dopbase \
|
||||
&& mkdir /data && chown dopbase:dopbase /data
|
||||
|
||||
COPY --from=builder /workspace/app/target/release/dopbase /usr/local/bin/dopbase
|
||||
|
||||
ENV DOPBASE_DATA_DIR=/data \
|
||||
DOPBASE_HOST=0.0.0.0 \
|
||||
DOPBASE_PORT=8840
|
||||
|
||||
USER dopbase
|
||||
VOLUME ["/data"]
|
||||
EXPOSE 8840
|
||||
|
||||
ENTRYPOINT ["dopbase"]
|
||||
CMD ["server", "start"]
|
||||
@@ -0,0 +1,34 @@
|
||||
services:
|
||||
dopbase:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
# branche ou tag du depot dopbase/dopbase (ex: main, v0.1.10)
|
||||
DOPBASE_REF: ${DOPBASE_REF:-main}
|
||||
image: dopbase:local
|
||||
container_name: dopbase
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
# 127.0.0.1 : accessible seulement depuis l'hote. Mettre un reverse proxy TLS devant
|
||||
# pour tout acces reseau (recommande par la doc), ou retirer "127.0.0.1:" pour exposer.
|
||||
- "127.0.0.1:${DOPBASE_PORT:-8840}:8840"
|
||||
environment:
|
||||
# URL que les clients utilisent (lien de setup, CLI). A adapter si reverse proxy.
|
||||
DOPBASE_PUBLIC_URL: ${DOPBASE_PUBLIC_URL:-http://localhost:8840}
|
||||
# Optionnel : cree root sans passer par le setup web (mot de passe genere, affiche UNE fois dans les logs).
|
||||
# Laisser vide pour utiliser le lien de setup web affiche dans les logs au premier demarrage.
|
||||
DOPBASE_ROOT_EMAIL: ${DOPBASE_ROOT_EMAIL:-}
|
||||
# Si un reverse proxy tourne devant (IP/CIDR du proxy), pour des logs d'audit corrects.
|
||||
DOPBASE_TRUSTED_PROXIES: ${DOPBASE_TRUSTED_PROXIES:-}
|
||||
volumes:
|
||||
# SQLite + master.key + backups (.dop) : a sauvegarder, la cle separement de la base.
|
||||
- dopbase-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/8840"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
|
||||
volumes:
|
||||
dopbase-data:
|
||||
Reference in new issue
Block a user