Site Tools


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

KingCon 4.0 - Node im Container

Der “Invoice-Manager”.

Eine Nodeanwendung, die eine moderen Bedieneroberfläche fürs KingCon-4.0 bietet.

Aktuell ist es so, dass für jedes neue Event/Indico ein neuer Container aufgesetzt wird.

neuer Container bei neuem Event / Indico

<note tip>Beispiel-URL: https://event.eec-2024.com/
Beispiel-Port: 15165 (ist so in der Config-Datei des nginx eingetragen)
Beispiel-Projekt: eec</note>

cd ~/dev/indico/invoice-manager
cp -r docker/production docker/production-eec
cp .env.sampl .env.eec.production

env.eec.production

DATABASE_URL=
SHADOW_DATABASE_URL=
DEFAULT_LANGUAGE=en
NEXT_PUBLIC_BASE_URL=https://event.eec-2024.com/
NEXT_PUBLIC_DEFAULT_LANGUAGE=en_GB

docker/production-eec/docker-compose.yml

version: '3'

services:
  eec-production:
    build:
      context: ../../
      dockerfile: docker/production-eec/Dockerfile
    image: eec-production
    ports:
      - '15165:3000'

docker/production-eec/Dockerfile

Nur an einer Stelle steht “eec”!

# 1. Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
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 "Lockfile not found." && exit 1; \
  fi


# 2. Rebuild the source code only when needed
FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
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:16-alpine AS runner
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://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static


USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]

dann weiter

Wir sind immer noch in ~/dev/indico/invoice-manager.

Das Makefile erweitern

.PHONY: build-production-eec
build-production-eec: ## Build the production docker image.
	docker compose -f docker/production-eec/docker-compose.yml build --no-cache

Jetzt fiel auf, dass docker auf dem lokalen PC noch fehlte … Installiert, mit WSL-Einbindung.

sudo make build-production-eec
sudo docker save eec-production > eec-production-230613.tar
scp eec-production-230613.tar root@193.254.190.30:/opt/eec/container

Das scp funktioniert, da auf dem Indico-Server schon das “klassische” Indico für eec eingerichtet ist und es die Ordner gibt.

auf dem Indico-Server

… geht es dann so weiter.

Zusatzinformationen

Unterprojekte

js doku
Neues Projekt anlegen: projekte:indico:kingcon_4.0_-_node_im_container

Kommentare

projekte/indico/kingcon_4.0_-_node_im_container.txt · Last modified: 2024/01/05 13:07 by 127.0.0.1