diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9a49266 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.idea/ +.git/ +.vscode/ + +dist/ + +.env* +.flaskenv* +!.env.project +!.env.vault diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5da2791 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM docker.io/oven/bun:alpine AS build + +ENV NODE_ENV=production + +WORKDIR /usr/src/app +RUN chown -R bun:bun /usr/src/app +USER bun + +COPY tsconfig.app.json ./ +COPY tsconfig.node.json ./ +COPY tsconfig.json ./ +COPY package.json ./ +COPY bun.lock ./ +COPY vite.config.ts ./ +COPY svelte.config.js ./ + +RUN bun install --ignore-scripts --frozen-lockfile + +COPY public ./public +COPY src ./src +COPY index.html ./ +COPY nginx ./nginx + +RUN bun run build + +FROM nginx:stable-alpine as production + +# copy nginx configuration in side conf.d folder +COPY --from=build /usr/src/app/nginx /etc/nginx/conf.d + +# Copy the build output from the dist folder into the Nginx html directory +COPY --from=build /usr/src/app/dist /usr/share/nginx/html + +# Expose port 80 to allow access to the app +EXPOSE 80 + +# Run Nginx in the foreground +ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..01b10f5 --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,12 @@ +server { + listen 80; + + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri /index.html =404; + } +} diff --git a/package.json b/package.json index 743af63..516b5e7 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "build": "vite build", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json", - "lint": "eslint src" + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "type": "module" }