Install TimeTrex in PHP Docker image
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| .vagrant | ||||
							
								
								
									
										36
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| FROM php:7.4-apache-bullseye | ||||
| ARG URL=https://www.timetrex.com/direct_download/TimeTrex_Community_Edition-manual-installer.zip | ||||
|  | ||||
| # Install PHP extensions | ||||
| RUN apt-get update && \ | ||||
|     apt-get install -y --no-install-recommends \ | ||||
|         libarchive-tools \ | ||||
|         libpq-dev \ | ||||
|         zlib1g-dev \ | ||||
|         libpng-dev \ | ||||
|         libicu-dev \ | ||||
|         libxml2-dev \ | ||||
|         libzip-dev \ | ||||
|     && rm -rf /var/lib/apt/lists/* | ||||
| RUN docker-php-ext-install pgsql gd gettext intl soap zip bcmath | ||||
| RUN ln -s "$(which php)" /usr/bin/php | ||||
|  | ||||
| # Download and place TimeTrex | ||||
| RUN curl -s "$URL" | bsdtar -xf- -C /var/www/html/ && \ | ||||
|     cp -r /var/www/html/TimeTrex_*/* /var/www/html/ && \ | ||||
|     rm -rf /var/www/html/TimeTrex_* && \ | ||||
|     cp timetrex.ini.php-example_linux timetrex.ini.php | ||||
|  | ||||
| # Create directories | ||||
| RUN mkdir -p /var/timetrex/storage && \ | ||||
|     mkdir -p /var/log/timetrex && \ | ||||
|     chgrp -R www-data /var/timetrex/ && \ | ||||
|     chmod 775 -R /var/timetrex && \ | ||||
|     chgrp www-data -R /var/log/timetrex/ && \ | ||||
|     chmod 775 -R /var/log/timetrex && \ | ||||
|     chgrp www-data -R /var/www/html/ && \ | ||||
|     chmod 775 -R /var/www/html/ | ||||
|  | ||||
| # Add our own entrypoint | ||||
| COPY docker-timetrex-entrypoint /usr/local/bin | ||||
| ENTRYPOINT ["docker-timetrex-entrypoint"] | ||||
							
								
								
									
										12
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Vagrantfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| Vagrant.configure("2") do |config| | ||||
|   config.vm.box = "debian/bullseye64" | ||||
|   config.vm.network "forwarded_port", guest: 8080, host: 8080 | ||||
|   config.vm.provision "shell", inline: <<-EOF | ||||
|     export DEBIAN_FRONTEND=noninteractive | ||||
|     apt-get update | ||||
|     apt-get install -y docker.io docker-compose | ||||
|     usermod -aG docker vagrant | ||||
|     cd /vagrant | ||||
|     docker-compose up -d --build | ||||
|   EOF | ||||
| end | ||||
							
								
								
									
										23
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| version: '3' | ||||
|  | ||||
| services: | ||||
|   timetrex: | ||||
|     build: . | ||||
|     ports: | ||||
|       - 8080:80 | ||||
|     links: | ||||
|       - postgres | ||||
|     environment: | ||||
|       POSTGRES_PASSWORD: password | ||||
|       POSTGRES_HOST: postgres | ||||
|   postgres: | ||||
|     image: postgres:13-bullseye | ||||
|     volumes: | ||||
|       - postgres:/var/lib/postgresql/data | ||||
|     environment: | ||||
|       POSTGRES_DB: timetrex | ||||
|       POSTGRES_USER: timetrex | ||||
|       POSTGRES_PASSWORD: password | ||||
|  | ||||
| volumes: | ||||
|   postgres: | ||||
							
								
								
									
										10
									
								
								docker-timetrex-entrypoint
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								docker-timetrex-entrypoint
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| function timetrex_set() { | ||||
|   sed -i '/^'"$1"' /s/=.*$/= '"$2"'/' /var/www/html/timetrex.ini.php | ||||
| } | ||||
|  | ||||
| timetrex_set 'base_url' "${BASE_URL:=\/\/interface}" | ||||
| timetrex_set 'password' "$POSTGRES_PASSWORD" | ||||
| timetrex_set 'host'     "$POSTGRES_HOST" | ||||
| apache2-foreground | ||||
		Reference in New Issue
	
	Block a user