Hi,
I’m installing peertube with docker compose in order to work inside the container in bind mount mode. Essentially, according the documentation i’m started from the official docker compose files, downloaded the official repo from github, and mounted inside the container.
So, perhaps everything seems to be ok, i get too many dependecies errors such as, but not only:
2024-11-08 17:13:31 [0] Error: Cannot find module '/app/client/node_modules/.bin/ng'
2024-11-08 17:13:31 [0] at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
2024-11-08 17:13:31 [0] at Module._load (node:internal/modules/cjs/loader:981:27)
2024-11-08 17:13:31 [0] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
2024-11-08 17:13:31 [0] at node:internal/main/run_main_module:28:49 {
2024-11-08 17:13:31 [0] code: 'MODULE_NOT_FOUND',
My question is: there is a way in order to develop directly from the repo inside a docker container in bind mode way?
I attach my configuration files:
version: '3.8'
services:
# You can comment this webserver section if you want to use another webserver/proxy or test PeerTube in local
webserver:
image: chocobozzz/peertube-webserver:latest
# If you don't want to use the official image and build one from sources:
# build:
# context: .
# dockerfile: Dockerfile.nginx
env_file:
- .env
ports:
- "80:80"
- "443:443"
volumes:
- type: bind
# Switch sources if you downloaded the whole repository
source: ./PeerTube/support/nginx/peertube
#source: ./docker-volume/nginx/peertube
target: /etc/nginx/conf.d/peertube.template
- assets:/var/www/peertube/peertube-latest/client/dist:ro
- ./docker-volume/data:/var/www/peertube/storage
- certbot-www:/var/www/certbot
- ./docker-volume/certbot/conf:/etc/letsencrypt
- ./certs:/etc/letsencrypt/live/localhost
depends_on:
- peertube
restart: "always"
# You can comment this certbot section if you want to use another webserver/proxy or test PeerTube in local
certbot:
container_name: certbot
image: certbot/certbot
volumes:
- ./docker-volume/certbot/conf:/etc/letsencrypt
- certbot-www:/var/www/certbot
restart: unless-stopped
entrypoint: /bin/sh -c "trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;"
depends_on:
- webserver
peertube:
# If you don't want to use the official image and build one from sources:
build:
dockerfile: ./Dockerfile
#image: chocobozzz/peertube:production-bookworm
# Use a static IP for this container because nginx does not handle proxy host change without reload
# This container could be restarted on crash or until the postgresql database is ready for connection
networks:
default:
ipv4_address: 172.18.0.42
env_file:
- .env
ports:
- "1935:1935" # Comment if you don't want to use the live feature
- "3000:3000" # Client dev port
#- "9000:9000" # Uncomment if you use another webserver/proxy or test PeerTube in local, otherwise not suitable for production
volumes:
- ./PeerTube:/app
- ./entrypoint.sh:/app/entrypoint.sh
depends_on:
- postgres
- redis
- postfix
#restart: "always"
working_dir: /app
entrypoint: ./entrypoint.sh
postgres:
image: postgres:13-alpine
env_file:
- .env
volumes:
- ./docker-volume/db:/var/lib/postgresql/data
restart: "always"
redis:
image: redis:6-alpine
volumes:
- ./docker-volume/redis:/data
restart: "always"
postfix:
image: mwader/postfix-relay
env_file:
- .env
volumes:
- ./docker-volume/opendkim/keys:/etc/opendkim/keys
restart: "always"
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.18.0.0/16
gateway: 172.18.0.1
volumes:
assets:
certbot-www:
Dockerfile:
FROM node:18-bookworm-slim
# Install dependencies
RUN apt update \
&& apt install -y --no-install-recommends openssl ffmpeg python3 python3-pip ca-certificates gnupg gosu build-essential curl git \
&& gosu nobody true \
&& rm /var/lib/apt/lists/* -fR
# Add peertube user
RUN groupadd -r peertube \
&& useradd -r -g peertube -m peertube
# Install PeerTube
WORKDIR /app
USER root
RUN mkdir /data /config
RUN chown -R peertube:peertube /data /config
ENV NODE_ENV production
ENV NODE_CONFIG_DIR /app/config:/app/support/docker/production/config:/config
ENV PEERTUBE_LOCAL_CONFIG /config
VOLUME /data
VOLUME /config
# Expose API and RTMP
EXPOSE 9000 3000 1935
My Entrypoint:
#!/bin/bash
chown -R peertube:peertube .
echo "Install concurrently"
yarn global add concurrently
echo "Install Angular CLI"
yarn global add @angular/cli
echo "Installed Angular CLI"
yarn global add typescript
echo "Installed TSC"
yarn install --pure-lockfile
yarn dev
exit
In my entrypoint a have already tried to solve the dependencies errors without success.
Let me know.