Hotfix release available: 2025-05-14b "Librarian".
upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian".
upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian".
upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos".
upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos".
upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos".
upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum".
upgrade now! [54.2] (what's this?)
projekte:indico:kingcon_4.0_-_node_im_container
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| projekte:indico:kingcon_4.0_-_node_im_container [2023/06/13 14:10] – [neuer Container bei neuem Event / Indico] ecknigk | projekte:indico:kingcon_4.0_-_node_im_container [2024/01/05 13:07] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== KingCon 4.0 - Node im Container | ||
| + | |||
| + | **Der " | ||
| + | |||
| + | Eine Nodeanwendung, | ||
| + | |||
| + | Aktuell ist es so, dass für jedes neue Event/ | ||
| + | ===== neuer Container bei neuem Event / Indico ===== | ||
| + | |||
| + | <note tip> | ||
| + | Beispiel-Port: | ||
| + | Beispiel-Projekt: | ||
| + | |||
| + | < | ||
| + | cd ~/ | ||
| + | cp -r docker/ | ||
| + | cp .env.sampl .env.eec.production | ||
| + | </ | ||
| + | |||
| + | ==== env.eec.production ==== | ||
| + | |||
| + | < | ||
| + | DATABASE_URL= | ||
| + | SHADOW_DATABASE_URL= | ||
| + | DEFAULT_LANGUAGE=en | ||
| + | NEXT_PUBLIC_BASE_URL=https:// | ||
| + | NEXT_PUBLIC_DEFAULT_LANGUAGE=en_GB | ||
| + | </ | ||
| + | |||
| + | ==== docker/ | ||
| + | < | ||
| + | version: ' | ||
| + | |||
| + | services: | ||
| + | eec-production: | ||
| + | build: | ||
| + | context: ../../ | ||
| + | dockerfile: docker/ | ||
| + | image: eec-production | ||
| + | ports: | ||
| + | - ' | ||
| + | </ | ||
| + | |||
| + | ==== docker/ | ||
| + | |||
| + | Nur an einer Stelle steht " | ||
| + | |||
| + | < | ||
| + | # 1. Install dependencies only when needed | ||
| + | FROM node: | ||
| + | # Check https:// | ||
| + | RUN apk add --no-cache libc6-compat | ||
| + | |||
| + | # HOTFIX: CVE-2022-3996 | ||
| + | RUN apk upgrade libssl3 libcrypto3 | ||
| + | |||
| + | WORKDIR /app | ||
| + | |||
| + | # Install dependencies based on the preferred package manager | ||
| + | COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
| + | RUN \ | ||
| + | if [ -f yarn.lock ]; then yarn --frozen-lockfile; | ||
| + | elif [ -f package-lock.json ]; then npm ci; \ | ||
| + | elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \ | ||
| + | else echo " | ||
| + | fi | ||
| + | |||
| + | |||
| + | # 2. Rebuild the source code only when needed | ||
| + | FROM node: | ||
| + | WORKDIR /app | ||
| + | COPY --from=deps / | ||
| + | COPY . . | ||
| + | # This will do the trick, use the corresponding env file for each environment. | ||
| + | COPY .env.eec.production .env.production | ||
| + | RUN yarn next telemetry disable | ||
| + | RUN yarn build | ||
| + | |||
| + | # 3. Production image, copy all the files and run next | ||
| + | FROM node: | ||
| + | WORKDIR /app | ||
| + | |||
| + | ENV NODE_ENV=production | ||
| + | |||
| + | RUN addgroup -g 1001 -S nodejs | ||
| + | RUN adduser -S nextjs -u 1001 | ||
| + | |||
| + | COPY --from=builder /app/public ./public | ||
| + | |||
| + | # Automatically leverage output traces to reduce image size | ||
| + | # https:// | ||
| + | COPY --from=builder --chown=nextjs: | ||
| + | COPY --from=builder --chown=nextjs: | ||
| + | |||
| + | |||
| + | USER nextjs | ||
| + | |||
| + | EXPOSE 3000 | ||
| + | |||
| + | ENV PORT 3000 | ||
| + | |||
| + | CMD [" | ||
| + | </ | ||
| + | |||
| + | ==== dann weiter ==== | ||
| + | |||
| + | Wir sind immer noch in **'' | ||
| + | |||
| + | Das Makefile erweitern | ||
| + | |||
| + | < | ||
| + | .PHONY: build-production-eec | ||
| + | build-production-eec: | ||
| + | docker compose -f docker/ | ||
| + | </ | ||
| + | |||
| + | Jetzt fiel auf, dass docker auf dem lokalen PC noch fehlte ... Installiert, | ||
| + | |||
| + | < | ||
| + | sudo make build-production-eec | ||
| + | sudo docker save eec-production > eec-production-230613.tar | ||
| + | scp eec-production-230613.tar root@193.254.190.30:/ | ||
| + | </ | ||
| + | |||
| + | Das **'' | ||
| + | |||
| + | ==== auf dem Indico-Server ==== | ||
| + | |||
| + | ... geht es dann [[https:// | ||
| + | ===== Zusatzinformationen ===== | ||
| + | |||
| + | ===== Unterprojekte ===== | ||
| + | |||
| + | {{indexmenu> | ||
| + | \\ | ||
| + | Neues Projekt anlegen: | ||
| + | |||
| + | |||
| + | |||
| + | ===== Kommentare ===== | ||
| + | |||
| + | |||
| + | |||