Files
lasuite-messages/src/e2e/Dockerfile
T
jbpenrath 369bf83e05 🔧(e2e) setup e2e environment
Create a new project e2e based on playwright and setup a full dockerized e2e
environment
2025-11-25 23:27:48 +01:00

42 lines
1.1 KiB
Docker

# E2E tests Dockerfile
# Use docker CLI image to get docker binaries
FROM docker:27-cli AS docker-cli
# Main image
FROM node:22-slim
ENV npm_config_cache=/tmp/npm-cache
ENV PLAYWRIGHT_BROWSERS_PATH=/tmp/playwright-browsers
ENV HOME=/tmp
RUN npm install -g npm@11.6.2 && npm cache clean -f
# Copy docker and docker-compose binaries from docker-cli image
# Create the cli-plugins directory first
ARG DOCKER_USER
RUN mkdir -p /usr/local/libexec/docker/cli-plugins
COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker
COPY --from=docker-cli /usr/local/libexec/docker/cli-plugins/docker-compose /usr/local/libexec/docker/cli-plugins/docker-compose
WORKDIR /app
# Install deps and run all npm commands as the user running the container
COPY package*.json ./
# Install dependencies and postinstall playwright with deps
RUN npm install
# Copy test files
COPY . ./
# Fix ownership for the user (use numeric UID to avoid lookup issues)
RUN chown -R $DOCKER_USER /tmp/npm-cache /app
# Run test with unprivileged user
USER $DOCKER_USER
# Default command
CMD ["npm", "test"]