From a09edcae258152744a747e3c1acc55915cf998cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20L=C3=BCcke?= Date: Fri, 13 Jun 2025 19:02:58 +0200 Subject: [PATCH] =?UTF-8?q?Oberfl=C3=A4che=20Bereitstellen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compose.yml | 63 ++++++++++++++++++++++++--------------------- ui/.dockerignore | 2 ++ ui/Dockerfile | 17 ++++++++++-- ui/package.json | 1 + ui/svelte.config.js | 6 ++++- 5 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 ui/.dockerignore diff --git a/compose.yml b/compose.yml index 786849c..41d45cd 100644 --- a/compose.yml +++ b/compose.yml @@ -1,32 +1,35 @@ volumes: - logs: - driver: local + logs: + driver: local services: - api: - build: ./api/ - environment: - docker: "true" - ports: - - 8090:80 - volumes: - - ./api:/var/www - - logs:/var/www/logs - test-api: - build: ./api/ - environment: - docker: "true" - DATABASES_HOST: psql.torsten-hettstedt.net - DATABASES_NAME: testdb - DATABASES_USER: bruce - DATABASES_PASS: mypass - ports: - - 8091:80 - volumes: - - ./api:/var/www - - logs:/var/www/logs - ui: - build: ./ui/ - ports: - - 80:80 - depends_on: - - api \ No newline at end of file + api: + build: ./api/ + environment: + docker: "true" + ports: + - "8090:80" + volumes: + - ./api:/var/www + - logs:/var/www/logs + test-api: + build: ./api/ + environment: + docker: "true" + DATABASES_HOST: psql.torsten-hettstedt.net + DATABASES_NAME: testdb + DATABASES_USER: bruce + DATABASES_PASS: mypass + ports: + - "8091:80" + volumes: + - ./api:/var/www + - logs:/var/www/logs + ui: + build: ./ui/ + env_file: + - ui/.env + ports: + - "8080:3000" + depends_on: + - api + - test-api \ No newline at end of file diff --git a/ui/.dockerignore b/ui/.dockerignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/ui/.dockerignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/ui/Dockerfile b/ui/Dockerfile index 2ab11d1..c1ae596 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -1,3 +1,16 @@ -FROM httpd:2.4 +FROM node:22-alpine AS builder +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build +RUN npm prune --production -COPY ./public/ /usr/local/apache2/htdocs/ \ No newline at end of file +FROM node:22-alpine +WORKDIR /app +COPY --from=builder /app/build build/ +COPY --from=builder /app/node_modules node_modules/ +COPY package.json . +EXPOSE 3000 +ENV NODE_ENV=production +CMD [ "node", "build" ] \ No newline at end of file diff --git a/ui/package.json b/ui/package.json index f30b0b9..6814751 100644 --- a/ui/package.json +++ b/ui/package.json @@ -20,6 +20,7 @@ "@sveltejs/adapter-auto": "^6.0.0", "@sveltejs/kit": "^2.16.0", "@sveltejs/vite-plugin-svelte": "^5.0.0", + "@sveltejs/adapter-node": "^5.2.12", "svelte": "^5.0.0", "svelte-check": "^4.0.0", "typescript": "^5.0.0", diff --git a/ui/svelte.config.js b/ui/svelte.config.js index 2dc206d..ec551aa 100644 --- a/ui/svelte.config.js +++ b/ui/svelte.config.js @@ -1,6 +1,10 @@ +import adapter from '@sveltejs/adapter-node'; + /** @type {import('@sveltejs/kit').Config} */ const config = { - kit: {} + kit: { + adapter: adapter() + } }; export default config;