refactor: remove system-api from docker files

This commit is contained in:
Nicolas Meienberger 2023-02-12 18:42:01 +01:00 committed by Nicolas Meienberger
parent 88e0ccd7b9
commit 90115b149f
6 changed files with 2 additions and 226 deletions

View file

@ -8,20 +8,11 @@ RUN apt install -y openssl
RUN npm install node-gyp -g RUN npm install node-gyp -g
WORKDIR /api
COPY ./packages/system-api/package.json /api/package.json
RUN npm i
# ---
WORKDIR /dashboard WORKDIR /dashboard
COPY ./packages/dashboard/package.json /dashboard/package.json COPY ./packages/dashboard/package.json /dashboard/package.json
COPY ./packages/dashboard/prisma/schema.prisma /dashboard/prisma/ COPY ./packages/dashboard/prisma/schema.prisma /dashboard/prisma/
RUN npm i RUN npm i
WORKDIR /api
COPY ./packages/system-api /api
RUN npm run build
# ---
WORKDIR /dashboard
COPY ./packages/dashboard /dashboard COPY ./packages/dashboard /dashboard
RUN npm run build RUN npm run build
@ -30,12 +21,6 @@ FROM node:${NODE_VERSION}-buster-slim as app
RUN apt update RUN apt update
RUN apt install -y openssl RUN apt install -y openssl
WORKDIR /
WORKDIR /api
COPY ./packages/system-api/package.json /api/
COPY --from=builder /api/dist /api/dist
WORKDIR /dashboard WORKDIR /dashboard
COPY --from=builder /dashboard/next.config.mjs ./ COPY --from=builder /dashboard/next.config.mjs ./
COPY --from=builder /dashboard/migrations ./migrations COPY --from=builder /dashboard/migrations ./migrations
@ -44,4 +29,4 @@ COPY --from=builder /dashboard/package.json ./package.json
COPY --from=builder --chown=node:node /dashboard/.next/standalone ./ COPY --from=builder --chown=node:node /dashboard/.next/standalone ./
COPY --from=builder --chown=node:node /dashboard/.next/static ./.next/static COPY --from=builder --chown=node:node /dashboard/.next/static ./.next/static
WORKDIR / CMD ["npm", "run", "start"]

View file

@ -14,11 +14,6 @@ COPY ./packages/dashboard/package*.json /dashboard/
COPY ./packages/dashboard/prisma/schema.prisma /dashboard/prisma/ COPY ./packages/dashboard/prisma/schema.prisma /dashboard/prisma/
RUN npm install RUN npm install
WORKDIR /api
COPY ./packages/system-api/package*.json /api/
RUN npm install
COPY ./packages/system-api /api
COPY ./packages/dashboard /dashboard COPY ./packages/dashboard /dashboard
WORKDIR / CMD ["npm", "run", "dev"]

View file

@ -50,61 +50,14 @@ services:
networks: networks:
- tipi_main_network - tipi_main_network
api:
build:
context: .
dockerfile: Dockerfile.dev
command: /bin/sh -c "cd /api && npm run build && npm run dev"
depends_on:
tipi-db:
condition: service_healthy
container_name: api
volumes:
- ${PWD}/repos:/runtipi/repos:ro
- ${PWD}/apps:/runtipi/apps
- ${PWD}/state:/runtipi/state
- ${PWD}/packages/system-api/src:/api/src
- ${STORAGE_PATH}:/app/storage
- ${PWD}/logs:/app/logs
- ${PWD}/.env.dev:/runtipi/.env
# - /api/node_modules
environment:
INTERNAL_IP: ${INTERNAL_IP}
TIPI_VERSION: ${TIPI_VERSION}
JWT_SECRET: ${JWT_SECRET}
NGINX_PORT: ${NGINX_PORT}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USERNAME: tipi
POSTGRES_DBNAME: tipi
POSTGRES_HOST: tipi-db
APPS_REPO_ID: ${APPS_REPO_ID}
APPS_REPO_URL: ${APPS_REPO_URL}
DOMAIN: ${DOMAIN}
ARCHITECTURE: ${ARCHITECTURE}
networks:
- tipi_main_network
labels:
traefik.enable: true
# Web
traefik.http.routers.api.rule: PathPrefix(`/api-legacy`)
traefik.http.routers.api.service: api
traefik.http.routers.api.entrypoints: web
traefik.http.routers.api.middlewares: api-stripprefix
traefik.http.services.api.loadbalancer.server.port: 3001
# Middlewares
traefik.http.middlewares.api-stripprefix.stripprefix.prefixes: /api-legacy
dashboard: dashboard:
build: build:
context: . context: .
dockerfile: Dockerfile.dev dockerfile: Dockerfile.dev
command: /bin/sh -c "cd /dashboard && npm run dev"
container_name: dashboard container_name: dashboard
depends_on: depends_on:
tipi-db: tipi-db:
condition: service_healthy condition: service_healthy
api:
condition: service_started
environment: environment:
NODE_ENV: development NODE_ENV: development
INTERNAL_IP: ${INTERNAL_IP} INTERNAL_IP: ${INTERNAL_IP}

View file

@ -45,65 +45,14 @@ services:
networks: networks:
- tipi_main_network - tipi_main_network
api:
image: meienberger/runtipi:rc-${TIPI_VERSION}
command: /bin/sh -c "cd /api && npm run start"
container_name: api
depends_on:
tipi-db:
condition: service_healthy
volumes:
- ${PWD}/repos:/runtipi/repos:ro
- ${PWD}/apps:/runtipi/apps
- ${PWD}/state:/runtipi/state
- ${PWD}/logs:/app/logs
- ${STORAGE_PATH}:/app/storage
- ${PWD}/.env:/runtipi/.env:ro
environment:
INTERNAL_IP: ${INTERNAL_IP}
TIPI_VERSION: ${TIPI_VERSION}
JWT_SECRET: ${JWT_SECRET}
NGINX_PORT: ${NGINX_PORT}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USERNAME: tipi
POSTGRES_DBNAME: tipi
POSTGRES_HOST: tipi-db
NODE_ENV: production
APPS_REPO_ID: ${APPS_REPO_ID}
APPS_REPO_URL: ${APPS_REPO_URL}
DOMAIN: ${DOMAIN}
ARCHITECTURE: ${ARCHITECTURE}
networks:
- tipi_main_network
labels:
traefik.enable: true
# Web
traefik.http.routers.api.rule: PathPrefix(`/api-legacy`)
traefik.http.routers.api.service: api
traefik.http.routers.api.entrypoints: web
traefik.http.routers.api.middlewares: api-stripprefix
traefik.http.services.api.loadbalancer.server.port: 3001
# Websecure
traefik.http.routers.api-secure.rule: (Host(`${DOMAIN}`) && PathPrefix(`/api-legacy`))
traefik.http.routers.api-secure.entrypoints: websecure
traefik.http.routers.api-secure.service: api-secure
traefik.http.routers.api-secure.tls.certresolver: myresolver
traefik.http.routers.api-secure.middlewares: api-stripprefix
traefik.http.services.api-secure.loadbalancer.server.port: 3001
# Middlewares
traefik.http.middlewares.api-stripprefix.stripprefix.prefixes: /api
dashboard: dashboard:
image: meienberger/runtipi:rc-${TIPI_VERSION} image: meienberger/runtipi:rc-${TIPI_VERSION}
command: /bin/sh -c "cd /dashboard && npm run start"
container_name: dashboard container_name: dashboard
networks: networks:
- tipi_main_network - tipi_main_network
depends_on: depends_on:
tipi-db: tipi-db:
condition: service_healthy condition: service_healthy
api:
condition: service_started
environment: environment:
NODE_ENV: production NODE_ENV: production
INTERNAL_IP: ${INTERNAL_IP} INTERNAL_IP: ${INTERNAL_IP}

View file

@ -44,62 +44,10 @@ services:
networks: networks:
- tipi_main_network - tipi_main_network
api:
build:
context: .
dockerfile: Dockerfile
command: /bin/sh -c "cd /api && npm run start"
restart: unless-stopped
container_name: api
depends_on:
tipi-db:
condition: service_healthy
volumes:
- ${PWD}/repos:/runtipi/repos:ro
- ${PWD}/apps:/runtipi/apps
- ${PWD}/state:/runtipi/state
- ${PWD}/logs:/app/logs
- ${STORAGE_PATH}:/app/storage
- ${PWD}/.env:/runtipi/.env:ro
environment:
INTERNAL_IP: ${INTERNAL_IP}
TIPI_VERSION: ${TIPI_VERSION}
JWT_SECRET: ${JWT_SECRET}
NGINX_PORT: ${NGINX_PORT}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USERNAME: tipi
POSTGRES_DBNAME: tipi
POSTGRES_HOST: tipi-db
NODE_ENV: production
APPS_REPO_ID: ${APPS_REPO_ID}
APPS_REPO_URL: ${APPS_REPO_URL}
DOMAIN: ${DOMAIN}
ARCHITECTURE: ${ARCHITECTURE}
networks:
- tipi_main_network
labels:
traefik.enable: true
# Web
traefik.http.routers.api.rule: PathPrefix(`/api-legacy`)
traefik.http.routers.api.service: api
traefik.http.routers.api.entrypoints: web
traefik.http.routers.api.middlewares: api-stripprefix
traefik.http.services.api.loadbalancer.server.port: 3001
# Websecure
traefik.http.routers.api-secure.rule: (Host(`${DOMAIN}`) && PathPrefix(`/api-legacy`))
traefik.http.routers.api-secure.entrypoints: websecure
traefik.http.routers.api-secure.service: api-secure
traefik.http.routers.api-secure.tls.certresolver: myresolver
traefik.http.routers.api-secure.middlewares: api-stripprefix
traefik.http.services.api-secure.loadbalancer.server.port: 3001
# Middlewares
traefik.http.middlewares.api-stripprefix.stripprefix.prefixes: /api-legacy
dashboard: dashboard:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
command: /bin/sh -c "cd /dashboard && npm run start"
restart: unless-stopped restart: unless-stopped
container_name: dashboard container_name: dashboard
networks: networks:
@ -107,8 +55,6 @@ services:
depends_on: depends_on:
tipi-db: tipi-db:
condition: service_healthy condition: service_healthy
api:
condition: service_started
environment: environment:
NODE_ENV: production NODE_ENV: production
INTERNAL_IP: ${INTERNAL_IP} INTERNAL_IP: ${INTERNAL_IP}

View file

@ -44,58 +44,8 @@ services:
networks: networks:
- tipi_main_network - tipi_main_network
api:
image: meienberger/runtipi:${TIPI_VERSION}
command: /bin/sh -c "cd /api && npm run start"
restart: unless-stopped
container_name: api
depends_on:
tipi-db:
condition: service_healthy
volumes:
- ${PWD}/repos:/runtipi/repos:ro
- ${PWD}/apps:/runtipi/apps
- ${PWD}/state:/runtipi/state
- ${PWD}/logs:/app/logs
- ${STORAGE_PATH}:/app/storage
- ${PWD}/.env:/runtipi/.env:ro
environment:
INTERNAL_IP: ${INTERNAL_IP}
TIPI_VERSION: ${TIPI_VERSION}
JWT_SECRET: ${JWT_SECRET}
NGINX_PORT: ${NGINX_PORT}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USERNAME: tipi
POSTGRES_DBNAME: tipi
POSTGRES_HOST: tipi-db
NODE_ENV: production
APPS_REPO_ID: ${APPS_REPO_ID}
APPS_REPO_URL: ${APPS_REPO_URL}
DOMAIN: ${DOMAIN}
ARCHITECTURE: ${ARCHITECTURE}
networks:
- tipi_main_network
labels:
traefik.enable: true
# Web
traefik.http.routers.api.rule: PathPrefix(`/api-legacy`)
traefik.http.routers.api.service: api
traefik.http.routers.api.entrypoints: web
traefik.http.routers.api.middlewares: api-stripprefix
traefik.http.services.api.loadbalancer.server.port: 3001
# Websecure
traefik.http.routers.api-secure.rule: (Host(`${DOMAIN}`) && PathPrefix(`/api-legacy`))
traefik.http.routers.api-secure.entrypoints: websecure
traefik.http.routers.api-secure.service: api-secure
traefik.http.routers.api-secure.tls.certresolver: myresolver
traefik.http.routers.api-secure.middlewares: api-stripprefix
traefik.http.services.api-secure.loadbalancer.server.port: 3001
# Middlewares
traefik.http.middlewares.api-stripprefix.stripprefix.prefixes: /api
dashboard: dashboard:
image: meienberger/runtipi:${TIPI_VERSION} image: meienberger/runtipi:${TIPI_VERSION}
command: /bin/sh -c "cd /dashboard && npm run start"
restart: unless-stopped restart: unless-stopped
container_name: dashboard container_name: dashboard
networks: networks:
@ -103,8 +53,6 @@ services:
depends_on: depends_on:
tipi-db: tipi-db:
condition: service_healthy condition: service_healthy
api:
condition: service_started
environment: environment:
NODE_ENV: production NODE_ENV: production
INTERNAL_IP: ${INTERNAL_IP} INTERNAL_IP: ${INTERNAL_IP}