From f3af64923cd4b9cda41721304b3b7224bca24810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20H=C3=A1jek?= Date: Sun, 2 Feb 2025 16:09:07 +0100 Subject: [PATCH] =?UTF-8?q?P=C5=99esun=20json=20databaze=20(souboru=20db.j?= =?UTF-8?q?son)=20do=20slo=C5=BEky=20data,=20souvisej=C3=ADc=C3=AD=20?= =?UTF-8?q?=C3=BApravy=20v=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 +++++--- server/src/storage/json.ts | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca5c9c7..e240d43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,7 +54,6 @@ WORKDIR /app # Vykopírování sestaveného serveru COPY --from=builder /build/server/node_modules ./server/node_modules COPY --from=builder /build/server/dist ./ -COPY server/resources ./server/resources # Vykopírování sestaveného klienta COPY --from=builder /build/client/dist ./public @@ -63,8 +62,11 @@ COPY --from=builder /build/client/dist ./public COPY /server/.env.production ./server/src # Zkopírování konfigurace easter eggů -# TODO tohle spadne když nebude existovat! -COPY /server/.easter-eggs.json ./server/ +RUN if [ -f /server/.easter-eggs.json ]; then cp /server/.easter-eggs.json ./server/; fi + +# Export /data/db.json do složky /data +VOLUME ["/data"] +COPY /data/db.json /data/db.json EXPOSE 3000 diff --git a/server/src/storage/json.ts b/server/src/storage/json.ts index be331b1..23a7b88 100644 --- a/server/src/storage/json.ts +++ b/server/src/storage/json.ts @@ -1,8 +1,7 @@ import JSONdb from 'simple-json-db'; import { StorageInterface } from "./StorageInterface"; -const db = new JSONdb('./data.json'); - +const db = new JSONdb('../data/db.json'); /** * Implementace úložiště používající JSON soubor. */