diff --git a/Dockerfile b/Dockerfile index d4b10f8..e6a0470 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,19 @@ -# use the official Bun image -# see all versions at https://hub.docker.com/r/oven/bun/tags -FROM oven/bun:1 AS build +# Build stage +FROM node:20-alpine AS builder + WORKDIR /app +COPY ./website /app +RUN npm install +RUN npm run generate -COPY website/package.json bun.lock* ./ +# Serve stage +FROM nginx:alpine3.17-slim -# use ignore-scripts to avoid builting node modules like better-sqlite3 -RUN bun install --frozen-lockfile --ignore-scripts +# Copy built files from Vite's dist folder +COPY --from=builder /app/.output/public /usr/share/nginx/html +#COPY --from=builder /app/tranga-website/media /usr/share/nginx/html/media +COPY ./nginx /etc/nginx -# Copy the entire project -COPY website/* . - -RUN bun --bun run build - -# copy production dependencies and source code into final image -FROM oven/bun:1 AS production -WORKDIR /app - -# Only `.output` folder is needed from the build stage -COPY --from=build /app/.output /app - -# run the app -EXPOSE 3000/tcp -ENTRYPOINT [ "bun", "--bun", "run", "/app/server/index.mjs" ] +EXPOSE 80 +ENV API_URL=http://tranga-api:6531 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/website/package-lock.json b/website/package-lock.json index 930ddb4..6fcd25a 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -10790,7 +10790,6 @@ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.1.tgz", "integrity": "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg==", "license": "MPL-2.0", - "peer": true, "dependencies": { "detect-libc": "^2.0.3" }, @@ -14690,7 +14689,6 @@ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.4.tgz", "integrity": "sha512-CLEVl+MnPAiKh5pl4dEWSyMTpuflgNQiLGhMv8ezD5W/qP8AKvmYpCOKRRNOh7oRKnauBZ4SyeYkMS+1VSyKwQ==", "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -15865,6 +15863,7 @@ "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.0.tgz", "integrity": "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==", "license": "BSD-2-Clause", + "peer": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", diff --git a/website/package.json b/website/package.json index 656b8ed..e873970 100644 --- a/website/package.json +++ b/website/package.json @@ -10,7 +10,7 @@ "postinstall": "nuxt prepare", "prettier": "prettier . --write", "lint": "eslint . --fix", - "clean": "eslint . --fix && prettier . --write" + "clean": "eslint . --fix && prettier . --write" }, "dependencies": { "@nuxt/content": "^3.7.1",