Compare commits
2 Commits
8d27532dc0
...
c1118e9f25
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1118e9f25
|
||
|
|
eae1f84b92
|
@@ -1,4 +1,5 @@
|
|||||||
FROM node:22-slim AS base
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM node:22-alpine AS base
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
@@ -9,10 +10,17 @@ COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|||||||
COPY backend/package.json ./backend/
|
COPY backend/package.json ./backend/
|
||||||
COPY frontend/package.json ./frontend/
|
COPY frontend/package.json ./frontend/
|
||||||
COPY documentation/package.json ./documentation/
|
COPY documentation/package.json ./documentation/
|
||||||
RUN pnpm install --no-frozen-lockfile
|
|
||||||
|
# Utilisation du cache pour pnpm et installation figée
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
# On réinstalle après COPY pour s'assurer que tous les scripts de cycle de vie et les liens sont corrects
|
|
||||||
RUN pnpm install --no-frozen-lockfile
|
# Deuxième passe avec cache pour les scripts/liens
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
RUN pnpm run --filter @memegoat/backend build
|
RUN pnpm run --filter @memegoat/backend build
|
||||||
RUN pnpm deploy --filter=@memegoat/backend --prod --legacy /app
|
RUN pnpm deploy --filter=@memegoat/backend --prod --legacy /app
|
||||||
RUN cp -r backend/dist /app/dist
|
RUN cp -r backend/dist /app/dist
|
||||||
|
|||||||
@@ -196,22 +196,26 @@ describe("S3Service", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should use DOMAIN_NAME and PORT for localhost", () => {
|
it("should use DOMAIN_NAME and PORT for localhost", () => {
|
||||||
(configService.get as jest.Mock).mockImplementation((key: string, def: any) => {
|
(configService.get as jest.Mock).mockImplementation(
|
||||||
|
(key: string, def: any) => {
|
||||||
if (key === "API_URL") return null;
|
if (key === "API_URL") return null;
|
||||||
if (key === "DOMAIN_NAME") return "localhost";
|
if (key === "DOMAIN_NAME") return "localhost";
|
||||||
if (key === "PORT") return 3000;
|
if (key === "PORT") return 3000;
|
||||||
return def;
|
return def;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
const url = service.getPublicUrl("test.webp");
|
const url = service.getPublicUrl("test.webp");
|
||||||
expect(url).toBe("http://localhost:3000/media/test.webp");
|
expect(url).toBe("http://localhost:3000/media/test.webp");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should use api.DOMAIN_NAME for production", () => {
|
it("should use api.DOMAIN_NAME for production", () => {
|
||||||
(configService.get as jest.Mock).mockImplementation((key: string, def: any) => {
|
(configService.get as jest.Mock).mockImplementation(
|
||||||
|
(key: string, def: any) => {
|
||||||
if (key === "API_URL") return null;
|
if (key === "API_URL") return null;
|
||||||
if (key === "DOMAIN_NAME") return "memegoat.fr";
|
if (key === "DOMAIN_NAME") return "memegoat.fr";
|
||||||
return def;
|
return def;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
const url = service.getPublicUrl("test.webp");
|
const url = service.getPublicUrl("test.webp");
|
||||||
expect(url).toBe("https://api.memegoat.fr/media/test.webp");
|
expect(url).toBe("https://api.memegoat.fr/media/test.webp");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# syntax=docker.io/docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM node:22-alpine AS base
|
FROM node:22-alpine AS base
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
@@ -11,11 +11,20 @@ COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|||||||
COPY backend/package.json ./backend/
|
COPY backend/package.json ./backend/
|
||||||
COPY frontend/package.json ./frontend/
|
COPY frontend/package.json ./frontend/
|
||||||
COPY documentation/package.json ./documentation/
|
COPY documentation/package.json ./documentation/
|
||||||
RUN pnpm install --no-frozen-lockfile
|
|
||||||
|
# Montage du cache pnpm
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
# On réinstalle après COPY pour s'assurer que tous les scripts de cycle de vie et les liens sont corrects
|
|
||||||
RUN pnpm install --no-frozen-lockfile
|
# Deuxième passe avec cache pour les scripts/liens
|
||||||
RUN pnpm run --filter @memegoat/documentation build
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# Build avec cache Next.js
|
||||||
|
RUN --mount=type=cache,id=next-docs-cache,target=/usr/src/app/documentation/.next/cache \
|
||||||
|
pnpm run --filter @memegoat/documentation build
|
||||||
|
|
||||||
FROM node:22-alpine AS runner
|
FROM node:22-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# syntax=docker.io/docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM node:22-alpine AS base
|
FROM node:22-alpine AS base
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
@@ -11,11 +11,20 @@ COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|||||||
COPY backend/package.json ./backend/
|
COPY backend/package.json ./backend/
|
||||||
COPY frontend/package.json ./frontend/
|
COPY frontend/package.json ./frontend/
|
||||||
COPY documentation/package.json ./documentation/
|
COPY documentation/package.json ./documentation/
|
||||||
RUN pnpm install --no-frozen-lockfile
|
|
||||||
|
# Montage du cache pnpm
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
# On réinstalle après COPY pour s'assurer que tous les scripts de cycle de vie et les liens sont corrects
|
|
||||||
RUN pnpm install --no-frozen-lockfile
|
# Deuxième passe avec cache pour les scripts/liens
|
||||||
RUN pnpm run --filter @memegoat/frontend build
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# Build avec cache Next.js
|
||||||
|
RUN --mount=type=cache,id=next-cache,target=/usr/src/app/frontend/.next/cache \
|
||||||
|
pnpm run --filter @memegoat/frontend build
|
||||||
|
|
||||||
FROM node:22-alpine AS runner
|
FROM node:22-alpine AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
Reference in New Issue
Block a user