EDIT: I also try to deploy my app via netlify and I get the same error.
My Dockerfile - for the sake of this. The root of my project is called app
# build stage
FROM node:14.15.5 as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"
My vite.config.js
import { fileURLToPath, URL } from 'url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
host: true,
port: 8080,
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
});
The error I get
> [build-stage 6/6] RUN npm run build:
#14 0.596
#14 0.596 > app@0.0.1 build /app#14 0.596 > vite build
#14 0.596
#14 0.846 vite v2.9.9 building for production...
#14 1.015 transforming...
#14 3.220 ✓ 51 modules transformed.
#14 3.221 [vite:css] ENOENT: no such file or directory, open '/app/src/assets/fonts/Shentox-light.ttf'
#14 3.221 file: /app/src/App.vue?vue&type=style&index=0&scoped=true&lang.css
#14 3.221 error during build:
#14 3.221 Error: ENOENT: no such file or directory, open '/app/src/assets/fonts/Shentox-light.ttf'
When I run npm run build without docker it works. Any insights?
Thanks -Coffee