test setup
This commit is contained in:
51
apps/website/Dockerfile.e2e
Normal file
51
apps/website/Dockerfile.e2e
Normal file
@@ -0,0 +1,51 @@
|
||||
# Optimized Dockerfile for Next.js e2e testing
|
||||
# Simplified approach to avoid multi-stage build issues
|
||||
|
||||
FROM node:20-alpine
|
||||
|
||||
# Install build dependencies required for SWC and sharp
|
||||
RUN apk add --no-cache \
|
||||
python3 \
|
||||
python3-dev \
|
||||
py3-pip \
|
||||
py3-setuptools \
|
||||
make \
|
||||
g++ \
|
||||
git \
|
||||
curl \
|
||||
&& ln -sf python3 /usr/bin/python
|
||||
|
||||
# Install sharp dependencies (if using image optimization)
|
||||
RUN apk add --no-cache vips-dev
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json package-lock.json* ./
|
||||
COPY apps/website/package.json apps/website/package-lock.json* ./apps/website/
|
||||
|
||||
# Install dependencies
|
||||
ENV NPM_CONFIG_FUND=false \
|
||||
NPM_CONFIG_AUDIT=false \
|
||||
NPM_CONFIG_UPDATE_NOTIFIER=false \
|
||||
NPM_CONFIG_PREFER_OFFLINE=true
|
||||
|
||||
# Install dependencies (use install instead of ci to handle missing sharp)
|
||||
RUN npm install --include-workspace-root --no-audit --fund=false
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the website
|
||||
WORKDIR /app/apps/website
|
||||
RUN npm run build
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f http://localhost:3000/ || exit 1
|
||||
|
||||
# Start command (production mode)
|
||||
CMD ["npm", "start"]
|
||||
@@ -34,17 +34,18 @@ export class SessionGateway {
|
||||
// Determine API base URL
|
||||
// In Docker/test: use API_BASE_URL env var or direct API URL
|
||||
// In production: use relative path which will be rewritten
|
||||
// The API is always at http://api:3000 in the Docker network
|
||||
const baseUrl = process.env.API_BASE_URL || 'http://localhost:3101';
|
||||
const apiUrl = `${baseUrl}/auth/session`;
|
||||
|
||||
// Fetch session from API with cookies forwarded
|
||||
// Use credentials: 'include' to ensure cookies are sent
|
||||
// In server-side fetch, we need to pass cookies explicitly
|
||||
// credentials: 'include' doesn't work in server-side fetch
|
||||
const response = await fetch(apiUrl, {
|
||||
headers: {
|
||||
cookie: cookieString,
|
||||
},
|
||||
cache: 'no-store',
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
// Return null for non-2xx responses
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"postcss": "^8.5.6",
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3",
|
||||
"sharp": "^0.33.5",
|
||||
"tailwindcss": "^3.4.18",
|
||||
"uuid": "^11.0.5",
|
||||
"zod": "^3.25.76"
|
||||
|
||||
Reference in New Issue
Block a user