mirror of
				https://github.com/pierre42100/Comunic-DockerSingleContainer
				synced 2025-11-04 12:14:09 +00:00 
			
		
		
		
	First commit
This commit is contained in:
		
							
								
								
									
										50
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
FROM debian
 | 
			
		||||
 | 
			
		||||
#Run in non-interactive mode
 | 
			
		||||
ENV DEBIAN_FRONTEND="noninteractive" HOME="/"
 | 
			
		||||
 | 
			
		||||
#Install dependencies
 | 
			
		||||
RUN apt update
 | 
			
		||||
RUN apt install -y apache2 php7.0 php7.0-mysql php7.0-gd php7.0-mbstring mysql-server git uglifyjs
 | 
			
		||||
 | 
			
		||||
#Add shorcuts
 | 
			
		||||
RUN echo 'eval "mysqld_safe&"; sleep 10;' > /root/start_mysql.sh
 | 
			
		||||
 | 
			
		||||
#Configure servers
 | 
			
		||||
RUN a2enmod rewrite
 | 
			
		||||
RUN sh /root/start_mysql.sh; mysqladmin -u root password root; mysql -e "CREATE DATABASE comunic"; exit
 | 
			
		||||
RUN sh /root/start_mysql.sh; mysql -e "CREATE USER 'comunic'@'localhost'; GRANT ALL PRIVILEGES ON comunic.* To 'comunic'@'localhost' IDENTIFIED BY 'comunic';"; exit
 | 
			
		||||
RUN rm /etc/apache2/sites-enabled/000-default.conf
 | 
			
		||||
COPY apache2.conf /etc/apache2/sites-enabled
 | 
			
		||||
 | 
			
		||||
#Retrieve Comunic API
 | 
			
		||||
RUN mkdir /data/
 | 
			
		||||
RUN git clone https://github.com/pierre42100/ComunicAPI /data/api
 | 
			
		||||
 | 
			
		||||
#Import database
 | 
			
		||||
RUN sh /root/start_mysql.sh; mysql comunic < /data/api/db_struct.sql; exit
 | 
			
		||||
 | 
			
		||||
#Create API client
 | 
			
		||||
RUN sh /root/start_mysql.sh; /data/api/bin/add_client client token; exit
 | 
			
		||||
 | 
			
		||||
#Update API config
 | 
			
		||||
COPY overwriteAPIconfig.php /data/api/config/
 | 
			
		||||
 | 
			
		||||
#Initialize user data directory
 | 
			
		||||
COPY empty_user_data_dir.tar.gz /root/
 | 
			
		||||
RUN mkdir /data/user_data/
 | 
			
		||||
RUN tar -xf /root/empty_user_data_dir.tar.gz -C /data/user_data
 | 
			
		||||
RUN chmod a+rwxX /data/user_data -R
 | 
			
		||||
 | 
			
		||||
#Retrieve Comunic Web APP
 | 
			
		||||
RUN git clone https://github.com/pierre42100/ComunicWeb /root/webapp 
 | 
			
		||||
 | 
			
		||||
#Build webapp
 | 
			
		||||
RUN /root/webapp/builder build docker
 | 
			
		||||
RUN mv /root/webapp/output/* /data; mv /root/webapp/output/.htaccess /data/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#Copy start script
 | 
			
		||||
COPY start.sh /root/start
 | 
			
		||||
RUN chmod +x /root/start
 | 
			
		||||
CMD /root/start
 | 
			
		||||
							
								
								
									
										12
									
								
								apache2.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								apache2.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
<Directory /data/>
 | 
			
		||||
    Options Indexes FollowSymLinks
 | 
			
		||||
    AllowOverride All
 | 
			
		||||
    Require all granted
 | 
			
		||||
</Directory>
 | 
			
		||||
 | 
			
		||||
<VirtualHost *:80>
 | 
			
		||||
    ServerAdmin webmaster@localhost
 | 
			
		||||
    DocumentRoot /data/
 | 
			
		||||
    ErrorLog ${APACHE_LOG_DIR}/error.log
 | 
			
		||||
    CustomLog ${APACHE_LOG_DIR}/access.log combined
 | 
			
		||||
</VirtualHost>
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								empty_user_data_dir.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								empty_user_data_dir.tar.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										13
									
								
								overwriteAPIconfig.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								overwriteAPIconfig.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
//Custom database configuration
 | 
			
		||||
$config->set("mysql", array(
 | 
			
		||||
    "host" => "localhost",
 | 
			
		||||
    "database" => "comunic",
 | 
			
		||||
    "user" => "comunic",
 | 
			
		||||
    "password" => "comunic"
 | 
			
		||||
));
 | 
			
		||||
 | 
			
		||||
//Storage configuration
 | 
			
		||||
$config->set("storage_path", "/data/user_data/");
 | 
			
		||||
$config->set("storage_url", "http://".$_SERVER["HTTP_HOST"]."/user_data/");
 | 
			
		||||
		Reference in New Issue
	
	Block a user