diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 1dd30de..fde37eb 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -2,17 +2,21 @@ FROM node:20 as frontend-builder WORKDIR /app -COPY . . - +COPY package.json . +COPY package-lock.json . RUN npm install + +COPY . . RUN npm run build -FROM node:20-alpine +FROM nginx:alpine -COPY --from=frontend-builder /app . +COPY --from=frontend-builder /app/build /usr/share/nginx/html +COPY run.sh . +RUN chmod +x run.sh -EXPOSE 4173 +EXPOSE 80 ENV PUBLIC_BACKEND_URL=http://localhost:3000 -CMD ["npm", "run", "preview", "--", "--port", "4173", "--host", "0.0.0.0"] +CMD ["./run.sh"] diff --git a/frontend/package-lock.json b/frontend/package-lock.json index e9b537a..46add6c 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -15,7 +15,7 @@ }, "devDependencies": { "@playwright/test": "^1.28.1", - "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/adapter-static": "^3.0.1", "@sveltejs/kit": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0", "@types/eslint": "8.56.0", @@ -824,14 +824,11 @@ "win32" ] }, - "node_modules/@sveltejs/adapter-auto": { + "node_modules/@sveltejs/adapter-static": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-3.0.1.tgz", - "integrity": "sha512-OpilmvRN136lUgOa9F0zpSI6g+PouOmk+YvJQrB+/hAtllLghjjYuoyfUsrF7U6oJ52cxCtAJTPXgZdyyCffrQ==", + "resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.1.tgz", + "integrity": "sha512-6lMvf7xYEJ+oGeR5L8DFJJrowkefTK6ZgA4JiMqoClMkKq0s6yvsd3FZfCFvX1fQ0tpCD7fkuRVHsnUVgsHyNg==", "dev": true, - "dependencies": { - "import-meta-resolve": "^4.0.0" - }, "peerDependencies": { "@sveltejs/kit": "^2.0.0" } @@ -2242,16 +2239,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/import-meta-resolve": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz", - "integrity": "sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", diff --git a/frontend/package.json b/frontend/package.json index 354cac9..fc93d40 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,7 +15,7 @@ }, "devDependencies": { "@playwright/test": "^1.28.1", - "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/adapter-static": "^3.0.1", "@sveltejs/kit": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0", "@types/eslint": "8.56.0", diff --git a/frontend/run.sh b/frontend/run.sh new file mode 100644 index 0000000..69e09df --- /dev/null +++ b/frontend/run.sh @@ -0,0 +1,5 @@ +PUBLIC_BACKEND_URL=${PUBLIC_BACKEND_URL:-http://localhost:3000} + +find /usr/share/nginx/html -type f -exec sed -i "s|http://localhost:3000|$PUBLIC_BACKEND_URL|g" {} + + +nginx -g 'daemon off;' diff --git a/frontend/src/lib/components/projects/SelectProject.svelte b/frontend/src/lib/components/projects/SelectProject.svelte index ac5f114..b7bf779 100644 --- a/frontend/src/lib/components/projects/SelectProject.svelte +++ b/frontend/src/lib/components/projects/SelectProject.svelte @@ -40,10 +40,10 @@ {:else}