Changes to docker configuration to decrease build time
This commit is contained in:
@@ -1,33 +1,20 @@
|
|||||||
FROM nginx:latest
|
# Stage 1: Build Vue app
|
||||||
RUN rm -rf /etc/nginx/html/*
|
FROM node:22-slim AS build
|
||||||
|
|
||||||
# Install dependencies needed to add NodeSource repo
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
curl \
|
|
||||||
build-essential \
|
|
||||||
git \
|
|
||||||
gettext-base \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install Node.js LTS + npm
|
|
||||||
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
|
|
||||||
&& apt-get install -y nodejs \
|
|
||||||
&& npm install -g npm@latest
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY vue/package.json vue/package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
COPY vue/ ./
|
COPY vue/ ./
|
||||||
RUN npm install
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Stage 2: Serve with nginx
|
||||||
RUN mkdir -p /etc/nginx/html \
|
FROM nginx:latest
|
||||||
&& cp -r ./dist/* /etc/nginx/html/
|
RUN rm -rf /etc/nginx/html/* && \
|
||||||
|
apt-get update && apt-get install -y gettext-base && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY --from=build /app/dist /etc/nginx/html/
|
||||||
COPY nginx.conf.template /etc/nginx/nginx.conf.template
|
COPY nginx.conf.template /etc/nginx/nginx.conf.template
|
||||||
COPY nginx_setup.conf.template /etc/nginx/nginx_setup.conf.template
|
COPY nginx_setup.conf.template /etc/nginx/nginx_setup.conf.template
|
||||||
COPY nginx_dev.conf.template /etc/nginx/nginx_dev.conf.template
|
COPY nginx_dev.conf.template /etc/nginx/nginx_dev.conf.template
|
||||||
COPY robots.txt /etc/nginx/html/robots.txt
|
COPY robots.txt /etc/nginx/html/robots.txt
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import vueDevTools from "vite-plugin-vue-devtools";
|
|||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue(), vueDevTools(), tailwindcss()],
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
...(process.env.NODE_ENV !== "production" ? [vueDevTools()] : []),
|
||||||
|
tailwindcss(),
|
||||||
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
|
|||||||
Reference in New Issue
Block a user