test: refs #6695 better Dockerfile.e2e
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-05 09:32:02 +01:00
parent f7ce244bf2
commit 1f38a34269
2 changed files with 22 additions and 24 deletions

View File

@ -1,15 +1,11 @@
# Etapa 1: Construcción de dependencias
FROM node:lts-bookworm AS builder
# Configurar PNPM
ENV SHELL=/bin/bash
FROM node:lts-bookworm
ENV SHELL bash
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm install -g pnpm@8.15.1 && \
pnpm setup
# Actualizar e instalar paquetes necesarios
RUN apt-get -y --fix-missing update && \
apt-get -y --fix-missing upgrade && \
apt-get -y --no-install-recommends install \
@ -28,31 +24,31 @@ RUN apt-get -y --fix-missing update && \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Establecer directorio de trabajo
WORKDIR /app
# Copiar archivos de configuración primero
COPY package.json .npmrc pnpm-lock.yaml ./
COPY \
package.json \
.npmrc \
pnpm-lock.yaml \
./
# Verificar si node_modules existe en el contexto
COPY node_modules ./node_modules
# Instalar dependencias (solo si node_modules no está disponible)
# Verifica si node_modules existe; si no, instala dependencias
RUN if [ ! -d "node_modules" ]; then \
pnpm install --frozen-lockfile; \
fi
pnpm install; \
fi && \
pnpm install cypress && \
npx cypress install
# Copiar dependencias desde la etapa de construcción
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/test/cypress ./test/cypress
COPY --from=builder /app/jsconfig.json ./jsconfig.json
COPY --from=builder /app/quasar.extensions.json ./quasar.extensions.json
COPY --from=builder /app/postcss.config.js ./postcss.config.js
COPY --from=builder /app/cypress.config.js ./cypress.config.js
COPY \
jsconfig.json \
quasar.extensions.json \
postcss.config.js \
cypress.config.js \
./
COPY test/cypress test/cypress
# Configuración de Cypress
ENV CYPRESS_BROWSER=chrome
ENV CHROME_BIN=/usr/bin/chromium
# Comando por defecto
CMD ["npx", "cypress", "run"]

View File

@ -13,6 +13,8 @@ services:
context: .
dockerfile: ./Dockerfile.e2e
network_mode: host
volumes:
- ./node_modules:/app/node_modules
# db:
# image: db
# command: npx myt run -t --ci -d -n front_default