diff --git a/.env.example b/.env.example index 8b0b7f5..2c597ef 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,5 @@ -UID = 1000 -GID = 1000 +UID=1000 +GID=1000 + +DOCKER_BUILDKIT=1 +COMPOSE_DOCKER_CLI_BUILD=1 diff --git a/Dockerfile b/Dockerfile index 6dd7059..154d0f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ ARG BASE=base-alpine # Alpine base definition FROM node:14-alpine AS base-alpine +RUN mkdir /var/autoplex && chown node:node -R /var/autoplex # Alpine dev definition FROM base-alpine AS base-alpine-dev @@ -23,10 +24,17 @@ RUN apk add build-base python3 # Slim base definition FROM node:14-slim AS base-slim +RUN mkdir /var/autoplex && chown node:node -R /var/autoplex +RUN apt-get update +RUN apt-get full-upgrade -y +RUN apt-get install -y libasound2 iputils-ping curl gnupg1 apt-transport-https dirmngr +RUN apt-get autoremove --purge -y +RUN rm -rf /var/lib/apt/lists/* # Slim dev definition FROM base-slim AS base-slim-dev + # Development Image -------------------------------------------------------------------------------- # Define the base image @@ -60,6 +68,7 @@ COPY lerna.json package.json tsconfig.json yarn.lock ./ RUN yarn install COPY packages packages COPY services/${SERVICE}/package.json ./services/${SERVICE}/ +COPY services/${SERVICE}/patches* ./services/${SERVICE}/patches # Cache an image containing only the prod-dependencies FROM builder AS prod-deps diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index d5fb806..ddfb478 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -29,26 +29,11 @@ services: # entrypoint: "/bin/sh" # tty: true - # torrent_client: - # build: - # target: base - # volumes: - # - ./torrent-client:/app - # # ulimits: - # # core: - # # hard: -1 - # # soft: -1 - # entrypoint: "/bin/sh" - # tty: true - - # torrent_client: - # build: - # target: base-dev - # volumes: - # - ./torrent-client-v2:/app - # # ulimits: - # # core: - # # hard: -1 - # # soft: -1 - # entrypoint: "/bin/sh" - # tty: true + torrent_client: + build: + target: dev + volumes: + - ./packages:/opt/app/packages + - ./services/torrent-client:/opt/app/services/torrent-client + entrypoint: "/bin/sh" + tty: true diff --git a/docker-compose.yml b/docker-compose.yml index 74c5761..3ab60d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -64,91 +64,74 @@ services: # volumes: # - var:/var/autoplex - # torrent_client: - # build: - # context: ./torrent-client - # depends_on: - # - "database" - # - "vpn" - # env_file: - # - ./torrent-client/.env - # healthcheck: - # test: ["CMD", "ping", "-q", "-c1", "google.com"] - # interval: 5m - # timeout: 10s - # retries: 3 - # start_period: 5m - # network_mode: service:vpn - # restart: unless-stopped - # secrets: - # - mysql_root_password - # user: ${UID}:${GID} - # volumes: - # - var:/var/autoplex + torrent_client: + build: + context: . + args: + BASE: base-slim + SERVICE: torrent-client + depends_on: + - "database" + - "vpn" + env_file: + - ./services/torrent-client/.env + healthcheck: + test: ["CMD", "ping", "-q", "-c1", "google.com"] + interval: 5m + timeout: 10s + retries: 3 + start_period: 5m + network_mode: service:vpn + restart: unless-stopped + secrets: + - mysql_root_password + user: ${UID}:${GID} + volumes: + - var:/var/autoplex - # torrent_client: - # build: - # context: ./torrent-client-v2 - # depends_on: - # - "vpn" - # env_file: - # - ./torrent-client-v2/.env - # healthcheck: - # test: ["CMD", "ping", "-q", "-c1", "google.com"] - # interval: 5m - # timeout: 10s - # retries: 3 - # start_period: 5m - # network_mode: service:vpn - # restart: unless-stopped - # user: ${UID}:${GID} - # volumes: - # - ./.volumes/storage:/storage/default - # - var:/var/autoplex - - # database: - # image: mysql - # command: --default-authentication-plugin=mysql_native_password - # environment: - # MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root_password - # ports: - # - 33061:3306 - # restart: unless-stopped - # security_opt: - # - seccomp=unconfined - # secrets: - # - mysql_root_password - # volumes: - # - ./database/init:/docker-entrypoint-initdb.d - # - mysql:/var/lib/mysql + database: + image: mysql + command: --default-authentication-plugin=mysql_native_password + environment: + MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root_password + ports: + - 33061:3306 + restart: unless-stopped + security_opt: + - seccomp=unconfined + secrets: + - mysql_root_password + volumes: + - ./bootstrap/database/init:/docker-entrypoint-initdb.d + - mysql:/var/lib/mysql - # vpn: - # build: - # context: ./vpn - # cap_add: - # - net_admin - # command: - # - '-f ""' - # environment: - # TZ: "CST6CDT" - # links: - # - "database" - # networks: - # - default - # read_only: true - # tmpfs: - # - /run - # - /tmp - # restart: unless-stopped - # secrets: - # - vpn_auth - # security_opt: - # - label:disable - # stdin_open: true - # tty: true - # volumes: - # - /dev/net:/dev/net:z - # - ./.volumes/vpn:/vpn + vpn: + build: + context: ./utils/vpn + cap_add: + - net_admin + command: + - '-f ""' + environment: + TZ: "CST6CDT" + links: + - "database" + networks: + - default + read_only: true + tmpfs: + - /run + - /tmp + restart: unless-stopped + secrets: + - vpn_auth + security_opt: + - label:disable + stdin_open: true + tty: true + volumes: + - /dev/net:/dev/net:z + - ./.volumes/vpn:/vpn secrets: app_key: diff --git a/utils/vpn b/utils/vpn index 4719b21..4b794a0 160000 --- a/utils/vpn +++ b/utils/vpn @@ -1 +1 @@ -Subproject commit 4719b210c6991ee3110afa4883829d7db9d4bb65 +Subproject commit 4b794a01fee06b523fa7d6f39162f593568d912c