dockerfile

This commit is contained in:
unurled 2025-02-07 21:33:00 +01:00
parent 62c2f68c64
commit b27a8d4ead
Signed by: unurled
GPG key ID: EFC5F5E709B47DDD
4 changed files with 62 additions and 1 deletions

10
.dockerignore Normal file
View file

@ -0,0 +1,10 @@
.idea/
.git/
.vscode/
dist/
.env*
.flaskenv*
!.env.project
!.env.vault

38
Dockerfile Normal file
View file

@ -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;"]

12
nginx/default.conf Normal file
View file

@ -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;
}
}

View file

@ -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"
}