Skip to content

Commit

Permalink
Split out dev and prod compose - and fix api copy js and fix/add ngin…
Browse files Browse the repository at this point in the history
…x copy js
  • Loading branch information
danwdart committed Jan 16, 2018
1 parent 6123175 commit 039d7ea
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 198 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ An open source, self-hosted video sharing service

## Development on Docker

Edits on the source repository will be propagated to the docker environment with this command instead of the above:
Edits on the source repository will be propagated to the docker environment, and rebuilds can be done with this command instead of the above:

`docker-compose -p chaplin -f servers/docker/docker-compose.dev.yml up -d`
`docker-compose -p chaplin -f servers/docker/docker-compose.yml -f servers/docker/docker-compose.dev.yml up -d`

## Manual install

Expand Down
176 changes: 0 additions & 176 deletions servers/docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,214 +1,38 @@
version: "3"
services:
node:
image: projectchaplin/node
environment:
- NODE_ENV=${NODE_ENV}
build:
context: ../..
dockerfile: servers/docker/node/Dockerfile
volumes:
- ../../src/js:/app
depends_on:
- redis
- mysql
- rabbitmq
api:
image: projectchaplin/api
build:
context: ../..
dockerfile: servers/docker/php/api/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
- UPLOADS_PATH=${UPLOADS_PATH}
- SQL_ADAPTER=${SQL_ADAPTER}
- SQL_PASSWORD=${SQL_PASSWORD}
- SQL_USER=${SQL_USER}
- SQL_DATABASE=${SQL_DATABASE}
- SQL_HOST=${SQL_HOST}
- SQL_PORT=${SQL_PORT}
- AMQP_HOST=${AMQP_HOST}
- AMQP_PORT=${AMQP_PORT}
- AMQP_USER=${AMQP_USER}
- AMQP_PASSWORD=${AMQP_PASSWORD}
- AMQP_VHOST=${AMQP_VHOST}
- SMTP_HOST=${SMTP_HOST}
- SMTP_USE_TLS=${SMTP_USE_TLS}
- SMTP_PORT=${SMTP_PORT}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- YOUTUBE_API_TOKEN=${YOUTUBE_API_TOKEN}
- VIMEO_CLIENT_SECRET=${VIMEO_CLIENT_SECRET}
- VIMEO_CLIENT_ID=${VIMEO_CLIENT_ID}
- VIMEO_ACCESS_TOKEN=${VIMEO_ACCESS_TOKEN}
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
- FACEBOOK_CLIENT_ID=${FACEBOOK_CLIENT_ID}
- FACEBOOK_CLIENT_SECRET=${FACEBOOK_CLIENT_SECRET}
- TWITTER_CONSUMER_KEY=${TWITTER_CONSUMER_KEY}
- TWITTER_CONSUMER_SECRET=${TWITTER_CONSUMER_SECRET}
- SCHEME=${SCHEME}
volumes:
- ../../src/php:/var/www
- uploads:/var/www/public/uploads
depends_on:
- redis
- mysql
- rabbitmq
- youtube_dl_api
cli_convert:
image: projectchaplin/cli_convert
build:
context: ../..
dockerfile: servers/docker/php/cli/convert/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
- UPLOADS_PATH=${UPLOADS_PATH}
- SQL_ADAPTER=${SQL_ADAPTER}
- SQL_PASSWORD=${SQL_PASSWORD}
- SQL_USER=${SQL_USER}
- SQL_DATABASE=${SQL_DATABASE}
- SQL_HOST=${SQL_HOST}
- SQL_PORT=${SQL_PORT}
- AMQP_HOST=${AMQP_HOST}
- AMQP_PORT=${AMQP_PORT}
- AMQP_USER=${AMQP_USER}
- AMQP_PASSWORD=${AMQP_PASSWORD}
- AMQP_VHOST=${AMQP_VHOST}
- SMTP_HOST=${SMTP_HOST}
- SMTP_USE_TLS=${SMTP_USE_TLS}
- SMTP_PORT=${SMTP_PORT}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
volumes:
- ../../src/php:/var/www
- uploads:/var/www/public/uploads
depends_on:
- redis
- mysql
- rabbitmq
- youtube_dl_api
cli_youtube:
image: projectchaplin/cli_youtube
build:
context: ../..
dockerfile: servers/docker/php/cli/youtube/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
- UPLOADS_PATH=${UPLOADS_PATH}
- SQL_ADAPTER=${SQL_ADAPTER}
- SQL_PASSWORD=${SQL_PASSWORD}
- SQL_USER=${SQL_USER}
- SQL_DATABASE=${SQL_DATABASE}
- SQL_HOST=${SQL_HOST}
- SQL_PORT=${SQL_PORT}
- AMQP_HOST=${AMQP_HOST}
- AMQP_PORT=${AMQP_PORT}
- AMQP_USER=${AMQP_USER}
- AMQP_PASSWORD=${AMQP_PASSWORD}
- AMQP_VHOST=${AMQP_VHOST}
- SMTP_HOST=${SMTP_HOST}
- SMTP_USE_TLS=${SMTP_USE_TLS}
- SMTP_PORT=${SMTP_PORT}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- YOUTUBE_API_TOKEN=${YOUTUBE_API_TOKEN}
volumes:
- ../../src/php:/var/www
- uploads:/var/www/public/uploads
depends_on:
- redis
- mysql
- rabbitmq
- youtube_dl_api
cli_vimeo:
image: projectchaplin/cli_vimeo
build:
context: ../..
dockerfile: servers/docker/php/cli/vimeo/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
- UPLOADS_PATH=${UPLOADS_PATH}
- SQL_ADAPTER=${SQL_ADAPTER}
- SQL_PASSWORD=${SQL_PASSWORD}
- SQL_USER=${SQL_USER}
- SQL_DATABASE=${SQL_DATABASE}
- SQL_HOST=${SQL_HOST}
- SQL_PORT=${SQL_PORT}
- AMQP_HOST=${AMQP_HOST}
- AMQP_PORT=${AMQP_PORT}
- AMQP_USER=${AMQP_USER}
- AMQP_PASSWORD=${AMQP_PASSWORD}
- AMQP_VHOST=${AMQP_VHOST}
- SMTP_HOST=${SMTP_HOST}
- SMTP_USE_TLS=${SMTP_USE_TLS}
- SMTP_PORT=${SMTP_PORT}
- SMTP_USER=${SMTP_USER}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- VIMEO_CLIENT_SECRET=${VIMEO_CLIENT_SECRET}
- VIMEO_CLIENT_ID=${VIMEO_CLIENT_ID}
- VIMEO_ACCESS_TOKEN=${VIMEO_ACCESS_TOKEN}
volumes:
- ../../src/php:/var/www
- uploads:/var/www/public/uploads
depends_on:
- redis
- mysql
- rabbitmq
- youtube_dl_api
youtube_dl_api:
image: robhor/youtube-dl-api-server
volumes:
- uploads:/uploads
nginx:
image: projectchaplin/nginx
build:
context: ../..
dockerfile: servers/docker/nginx/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- VHOST=${VHOST}
- VHOST_PORT=${VHOST_PORT}
- VHOST_SHORT=${VHOST_SHORT}
- VHOST_NODE=${VHOST_NODE}
- VHOST_NODE_PORT=${VHOST_NODE_PORT}
- VHOST_GUI=${VHOST_GUI}
- API_HOST=${API_HOST}
- API_PORT=${API_PORT}
- NODE_HOST=${NODE_HOST}
- NODE_PORT=${NODE_PORT}
volumes:
- ../../src/php:/var/www
- uploads:/var/www/public/uploads
depends_on:
- node
- api
ports:
- 80:80
redis:
image: redis
mysql:
environment:
- MYSQL_ROOT_PASSWORD=${SQL_PASSWORD}
- MYSQL_DATABASE=${SQL_DATABASE}
- MYSQL_USER=${SQL_USER}
- MYSQL_PASSWORD=${SQL_PASSWORD}
image: mysql
volumes:
- mysql:/var/lib/mysql
- ../../db/sql/:/docker-entrypoint-initdb.d/
rabbitmq:
environment:
- RABBITMQ_DEFAULT_USER=${AMQP_USER}
- RABBITMQ_DEFAULT_PASS=${AMQP_PASSWORD}
- RABBITMQ_DEFAULT_VHOST=${AMQP_VHOST}
image: rabbitmq:management
ports:
- 15672:15672
volumes:
mysql:
uploads:
18 changes: 0 additions & 18 deletions servers/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ services:
image: projectchaplin/node
environment:
- NODE_ENV=${NODE_ENV}
build:
context: ../..
dockerfile: servers/docker/node/Dockerfile
depends_on:
- redis
- mysql
- rabbitmq
api:
image: projectchaplin/api
build:
context: ../..
dockerfile: servers/docker/php/api/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
Expand Down Expand Up @@ -56,9 +50,6 @@ services:
- youtube_dl_api
cli_convert:
image: projectchaplin/cli_convert
build:
context: ../..
dockerfile: servers/docker/php/cli/convert/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
Expand Down Expand Up @@ -88,9 +79,6 @@ services:
- youtube_dl_api
cli_youtube:
image: projectchaplin/cli_youtube
build:
context: ../..
dockerfile: servers/docker/php/cli/youtube/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
Expand Down Expand Up @@ -121,9 +109,6 @@ services:
- youtube_dl_api
cli_vimeo:
image: projectchaplin/cli_vimeo
build:
context: ../..
dockerfile: servers/docker/php/cli/vimeo/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- EMAILS_PATH=${EMAILS_PATH}
Expand Down Expand Up @@ -160,9 +145,6 @@ services:
- uploads:/uploads
nginx:
image: projectchaplin/nginx
build:
context: ../..
dockerfile: servers/docker/nginx/Dockerfile
environment:
- APPLICATION_ENV=${APPLICATION_ENV}
- VHOST=${VHOST}
Expand Down
8 changes: 7 additions & 1 deletion servers/docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM nginx
FROM node as buildjs
WORKDIR /var/www
COPY src/php /var/www/
RUN npm install && npm run build

FROM nginx
COPY src/php /var/www/
COPY --from=buildjs /var/www/public/js /var/www/public/js
COPY servers/nginx /etc/nginx/conf.d/

CMD envsubst '$VHOST $VHOST_PORT $API_HOST $API_PORT $APPLICATION_ENV \
Expand Down
2 changes: 1 addition & 1 deletion servers/docker/php/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ COPY servers/php-fpm /usr/local/etc/php/conf.d/
COPY src/php /var/www/
RUN chown -R www-data:www-data /var/www/public/uploads
COPY --from=buildphp /var/www/vendor /var/www/vendor
COPY --from=buildjs /var/www/public/js public/js/
COPY --from=buildjs /var/www/public/js /var/www/public/js

0 comments on commit 039d7ea

Please sign in to comment.