Replace supervisord with s6-overlay
Also restructure container to have all the container relevant files in container-root to minimize the amount of COPY instructions and to make the file structure more organized.
This commit is contained in:
		
							parent
							
								
									12947572c7
								
							
						
					
					
						commit
						0834d43314
					
				|  | @ -1,10 +1,15 @@ | |||
| FROM buildpack-deps:xenial-scm | ||||
| MAINTAINER Kelvin Chen <kelvin@kelvinchen.org> | ||||
| 
 | ||||
| # For rtorrent | ||||
| ENV TERM=xterm | ||||
| 
 | ||||
| # Install dependencies | ||||
| RUN apt-get update \ | ||||
| RUN curl -sL "https://github.com/just-containers/s6-overlay/releases/download/v1.18.1.5/s6-overlay-amd64.tar.gz" \ | ||||
|         | tar xz -C / \ | ||||
|     && apt-get update \ | ||||
|     && apt-get install -y \ | ||||
|         supervisor \ | ||||
|         screen \ | ||||
|         rtorrent \ | ||||
|         mediainfo \ | ||||
|         php7.0-fpm \ | ||||
|  | @ -28,8 +33,6 @@ VOLUME /config /torrents | |||
| 
 | ||||
| EXPOSE 80 49161 49161/udp 6881/udp | ||||
| 
 | ||||
| COPY init rtorrent.rc supervisord.conf / | ||||
| COPY nginx.conf /etc/nginx/nginx.conf | ||||
| COPY rutorrent_config.php /opt/rutorrent/conf/config.php | ||||
| COPY container-root/ / | ||||
| 
 | ||||
| CMD ["/init"] | ||||
|  |  | |||
							
								
								
									
										9
									
								
								Dockerfiles/rtorrent/init → Dockerfiles/rtorrent/container-root/etc/cont-init.d/10-setup
								
								
								
								
									
									
									Executable file → Normal file
								
							
							
						
						
									
										9
									
								
								Dockerfiles/rtorrent/init → Dockerfiles/rtorrent/container-root/etc/cont-init.d/10-setup
								
								
								
								
									
									
									Executable file → Normal file
								
							|  | @ -1,16 +1,11 @@ | |||
| #!/usr/bin/env bash | ||||
| #!/usr/bin/with-contenv sh | ||||
| 
 | ||||
| # Make rtorrent session directory | ||||
| mkdir -p /config/rtorrent | ||||
| 
 | ||||
| # Add default config if it does not exist | ||||
| cp -n /rtorrent.rc /config/rtorrent/rtorrent.rc | ||||
| 
 | ||||
| # Remove rtorrent lock file if it exists so rtorrent can start | ||||
| rm -f /config/rtorrent/rtorrent.lock | ||||
| cp -n /etc/defaults/rtorrent.rc /config/rtorrent/rtorrent.rc | ||||
| 
 | ||||
| # Make folders for storing rutorrent data | ||||
| mkdir -p /config/rutorrent/settings /config/rutorrent/torrents \ | ||||
|     /config/rutorrent/users /config/rutorrent/plugins | ||||
| 
 | ||||
| exec supervisord -c /supervisord.conf | ||||
|  | @ -0,0 +1,3 @@ | |||
| #!/usr/bin/with-contenv sh | ||||
| 
 | ||||
| exec nginx -g "daemon off;" | ||||
|  | @ -0,0 +1,3 @@ | |||
| #!/usr/bin/with-contenv sh | ||||
| 
 | ||||
| exec php-fpm7.0 -F -R | ||||
|  | @ -0,0 +1,4 @@ | |||
| #!/usr/bin/with-contenv sh | ||||
| 
 | ||||
| # Make sure lock file is removed after end | ||||
| rm -f /config/rtorrent/rtorrent.lock | ||||
|  | @ -0,0 +1,6 @@ | |||
| #!/usr/bin/with-contenv sh | ||||
| 
 | ||||
| # Remove rtorrent lock file if it exists so rtorrent can start | ||||
| rm -f /config/rtorrent/rtorrent.lock | ||||
| 
 | ||||
| exec screen -D -m -S rtorrent rtorrent | ||||
|  | @ -1,20 +0,0 @@ | |||
| ; vim: ft=dosini | ||||
| 
 | ||||
| [supervisord] | ||||
| nodaemon = true | ||||
| 
 | ||||
| [program:rtorrent] | ||||
| priority = 1 | ||||
| environment = TERM=xterm | ||||
| command = rtorrent | ||||
| autorestart = true | ||||
| 
 | ||||
| [program:php] | ||||
| priority = 2 | ||||
| command = php-fpm7.0 -F -R | ||||
| autorestart = true | ||||
| 
 | ||||
| [program:nginx] | ||||
| priority = 3 | ||||
| command = nginx -g "daemon off;" | ||||
| autorestart = true | ||||
		Loading…
	
		Reference in New Issue