Skip to content

Commit

Permalink
update fingerprint-scanner-simulator build
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLi committed Jan 17, 2024
1 parent d78265a commit 7bd15d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN git lfs install
RUN git clone --depth 1 https://github.com/JohanLi/uncharted-waters-2
RUN cd uncharted-waters-2 && npm install && PUBLIC_PATH=/uncharted-waters-2/ npm run build
RUN git clone --depth 1 https://github.com/JohanLi/fingerprint-scanner-simulator
RUN cd fingerprint-scanner-simulator && npm install && BASE_PATH=/gta-online/fingerprint-scanner-simulator npm run build
RUN cd fingerprint-scanner-simulator && npm install -g pnpm && pnpm install --frozen-lockfile && BASE_PATH=/gta-online/fingerprint-scanner-simulator pnpm run build

FROM node:20-alpine AS runner
ENV NODE_ENV production
Expand All @@ -31,7 +31,7 @@ RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=others /app/uncharted-waters-2/build ./public/uncharted-waters-2
COPY --from=others /app/fingerprint-scanner-simulator/out ./public/gta-online/fingerprint-scanner-simulator
COPY --from=others /app/fingerprint-scanner-simulator/dist ./public/gta-online/fingerprint-scanner-simulator

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
Expand Down
21 changes: 12 additions & 9 deletions tests/production/cacheHeaders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ async function expectCache(
}

test.describe('Cache headers', () => {
test('johan.li', async ({ page }) => {
const js = page.waitForResponse((response) =>
response.url().endsWith('.js'),
test('johan.li', async ({ page, baseURL }) => {
const js = page.waitForResponse(
(response) =>
// https://static.cloudflareinsights.com/beacon.min.js interferes, hence the baseURL check
response.url().endsWith('.js') && response.url().startsWith(baseURL),
)

const css = page.waitForResponse((response) =>
response.url().endsWith('.css'),
)

const image = page.waitForResponse((response) =>
response.headers()['content-type'].startsWith('image/'),
response.headers()['content-type']?.startsWith('image/'),
)

await page.goto('/')
Expand All @@ -64,7 +66,7 @@ test.describe('Cache headers', () => {
)

const image = page.waitForResponse((response) =>
response.headers()['content-type'].startsWith('image/'),
response.headers()['content-type']?.startsWith('image/'),
)

await page.goto('/uncharted-waters-2')
Expand All @@ -77,17 +79,18 @@ test.describe('Cache headers', () => {
])
})

test('Fingerprint Scanner Simulator', async ({ page }) => {
const js = page.waitForResponse((response) =>
response.url().endsWith('.js'),
test('Fingerprint Scanner Simulator', async ({ page, baseURL }) => {
const js = page.waitForResponse(
(response) =>
response.url().endsWith('.js') && response.url().startsWith(baseURL),
)

const css = page.waitForResponse((response) =>
response.url().endsWith('.css'),
)

const image = page.waitForResponse((response) =>
response.headers()['content-type'].startsWith('image/'),
response.headers()['content-type']?.startsWith('image/'),
)

await page.goto('/gta-online/fingerprint-scanner-simulator')
Expand Down

0 comments on commit 7bd15d6

Please sign in to comment.