fetch new and build new version automatically
This commit is contained in:
		
							
								
								
									
										17
									
								
								.build/ci-helper
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								.build/ci-helper
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
cd "$(dirname "${BASH_SOURCE[0]}")"
 | 
			
		||||
 | 
			
		||||
VERSION_JSON=$(./get_latest_version.sh)
 | 
			
		||||
NEXTCLOUD_VERSION=$(echo $VERSION_JSON | jq -r .version)
 | 
			
		||||
NEXTCLOUD_URL=$(echo $VERSION_JSON | jq -r .url)
 | 
			
		||||
NEXTCLOUD_FILENAME=$(echo $VERSION_JSON | jq -r .filename)
 | 
			
		||||
 | 
			
		||||
export NEXTCLOUD_VERSION
 | 
			
		||||
export NEXTCLOUD_URL
 | 
			
		||||
export NEXTCLOUD_FILENAME
 | 
			
		||||
 | 
			
		||||
echo "Nextcloud Version: $NEXTCLOUD_VERSION"
 | 
			
		||||
echo "Nextcloud URL: $NEXTCLOUD_URL"
 | 
			
		||||
echo "Nextcloud Filename: $NEXTCLOUD_FILENAME"
 | 
			
		||||
 | 
			
		||||
docker compose $@
 | 
			
		||||
							
								
								
									
										17
									
								
								.build/compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								.build/compose.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
services:
 | 
			
		||||
  nextcloud:
 | 
			
		||||
    build:
 | 
			
		||||
      context: .
 | 
			
		||||
      dockerfile: nextcloud.Dockerfile
 | 
			
		||||
      args:
 | 
			
		||||
        NEXTCLOUD_VERSION: ${NEXTCLOUD_VERSION}
 | 
			
		||||
        NEXTCLOUD_URL: ${NEXTCLOUD_URL}
 | 
			
		||||
        NEXTCLOUD_FILENAME: ${NEXTCLOUD_FILENAME}
 | 
			
		||||
    hostname: nextcloud
 | 
			
		||||
    image: git.shihaam.dev/dockerfiles/nextcloud/nextcloud:${NEXTCLOUD_VERSION}
 | 
			
		||||
  nginx:
 | 
			
		||||
    build:
 | 
			
		||||
      context: .
 | 
			
		||||
      dockerfile: nginx.Dockerfile
 | 
			
		||||
    hostname: nginx
 | 
			
		||||
    image: git.shihaam.dev/dockerfiles/nextcloud/nginx
 | 
			
		||||
@@ -1,15 +0,0 @@
 | 
			
		||||
services:
 | 
			
		||||
  fpm:
 | 
			
		||||
    build:
 | 
			
		||||
      context: .
 | 
			
		||||
      dockerfile: fpm.Dockerfile
 | 
			
		||||
      args:
 | 
			
		||||
        - VERSION=29.0.3
 | 
			
		||||
    hostname: fpm
 | 
			
		||||
    image: git.shihaam.dev/dockerfiles/nextcloud/fpm:29.0.3
 | 
			
		||||
  nginx:
 | 
			
		||||
    build:
 | 
			
		||||
      context: .
 | 
			
		||||
      dockerfile: nginx.Dockerfile
 | 
			
		||||
    hostname: nginx
 | 
			
		||||
    image: git.shihaam.dev/dockerfiles/nextcloud/nginx
 | 
			
		||||
							
								
								
									
										21
									
								
								.build/entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								.build/entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [ ! -f /var/www/html/config/config.php ]; then
 | 
			
		||||
  touch /var/www/html/config/CAN_INSTALL
 | 
			
		||||
  cp /var/www/default_config.sample.php /var/www/html/config/config.sample.php
 | 
			
		||||
  echo "Created /var/www/html/config/CAN_INSTALL and config.sample.php because config.php does not exist."
 | 
			
		||||
else
 | 
			
		||||
  echo "config.php exists. No action taken."
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -z "$(ls -A /var/www/html/apps)" ]; then
 | 
			
		||||
    cp -r /var/www/default_apps/* /var/www/html/apps/
 | 
			
		||||
    echo "Copied default apps to /var/www/html/apps because it was empty."
 | 
			
		||||
else
 | 
			
		||||
  echo "/var/www/html/apps is not empty. No action taken."
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
## Set permissions
 | 
			
		||||
chown -R www-data:www-data /var/www/html/
 | 
			
		||||
 | 
			
		||||
exec "$@"
 | 
			
		||||
@@ -1,31 +0,0 @@
 | 
			
		||||
FROM git.shihaam.dev/dockerfiles/php-fpm:8.3
 | 
			
		||||
 | 
			
		||||
LABEL maintainer="Shiham Abdul Rahman <shihaam@shihaam.me>"
 | 
			
		||||
LABEL org.opencontainers.image.source="https://git.shihaam.dev/dockerfiles/nextcloud"
 | 
			
		||||
LABEL org.opencontainers.image.documentation="https://git.shihaam.dev/dockerfiles/nextcloud"
 | 
			
		||||
LABEL org.opencontainers.image.description="A simplified docker image for nextcloud"
 | 
			
		||||
 | 
			
		||||
ARG URL=https://download.nextcloud.com/server/releases/
 | 
			
		||||
ARG VERSION
 | 
			
		||||
WORKDIR /var/www/html
 | 
			
		||||
SHELL ["/bin/bash", "-c"]
 | 
			
		||||
 | 
			
		||||
# Download, Extract and Delete nextcloud tar.bz2
 | 
			
		||||
RUN curl ${URL}nextcloud-${VERSION}.tar.bz2 -o nextcloud-${VERSION}.tar.bz2 \
 | 
			
		||||
 && tar -vxjf nextcloud-${VERSION}.tar.bz2 \
 | 
			
		||||
 && mv -v nextcloud/* . \
 | 
			
		||||
 && rm -rv nextcloud nextcloud-${VERSION}.tar.bz2
 | 
			
		||||
 | 
			
		||||
# Installing basic tools
 | 
			
		||||
RUN apt-get update && apt-get install bzip2 zip unzip git gnupg2 ca-certificates lsb-release apt-transport-https wget curl nano vim -y --no-install-recommends \
 | 
			
		||||
 && apt-get auto-remove -y \
 | 
			
		||||
 && apt-get clean -y
 | 
			
		||||
 | 
			
		||||
# Copy php.ini config
 | 
			
		||||
COPY php.ini /usr/local/etc/php/php.ini
 | 
			
		||||
 | 
			
		||||
# Install Php stuff
 | 
			
		||||
RUN docker-php-ext-install {gd,mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}
 | 
			
		||||
 | 
			
		||||
# export volume for nginx to serve static files
 | 
			
		||||
VOLUME /var/www/html
 | 
			
		||||
							
								
								
									
										39
									
								
								.build/nextcloud.Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								.build/nextcloud.Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
FROM git.shihaam.dev/dockerfiles/php-fpm:8.3
 | 
			
		||||
 | 
			
		||||
ARG NEXTCLOUD_VERSION
 | 
			
		||||
ARG NEXTCLOUD_URL
 | 
			
		||||
ARG NEXTCLOUD_FILENAME
 | 
			
		||||
 | 
			
		||||
WORKDIR /var/www/html
 | 
			
		||||
SHELL ["/bin/bash", "-c"]
 | 
			
		||||
 | 
			
		||||
# Installing basic tools
 | 
			
		||||
RUN apt-get update \
 | 
			
		||||
 && apt-get install {bzip2,zip,unzip,gnupg2,ca-certificates,lsb-release,apt-transport-https,wget,curl,nano} -y --no-install-recommends \
 | 
			
		||||
 && apt-get auto-remove -y \
 | 
			
		||||
 && apt-get clean -y
 | 
			
		||||
 | 
			
		||||
# Download, Extract and Delete nextcloud tar.bz2
 | 
			
		||||
RUN wget $NEXTCLOUD_URL \
 | 
			
		||||
 && tar -vxjf $NEXTCLOUD_FILENAME \
 | 
			
		||||
 && mv -v nextcloud/* . \
 | 
			
		||||
 && rm -rv nextcloud $NEXTCLOUD_FILENAME
 | 
			
		||||
 | 
			
		||||
# install php plugins
 | 
			
		||||
RUN docker-php-ext-install {gd,mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}
 | 
			
		||||
 | 
			
		||||
## copy default config and apps for setup in entrypoint
 | 
			
		||||
RUN mv /var/www/html/config/config.sample.php /var/www/default_config.sample.php \
 | 
			
		||||
 && mv /var/www/html/apps/ /var/www/default_apps/
 | 
			
		||||
 | 
			
		||||
# copy php config
 | 
			
		||||
COPY php.ini /usr/local/etc/php/php.ini
 | 
			
		||||
 | 
			
		||||
# copy and setup entrypoint
 | 
			
		||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
 | 
			
		||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
 | 
			
		||||
 | 
			
		||||
# export volume for nginx to serve static files
 | 
			
		||||
VOLUME /var/www/html
 | 
			
		||||
 | 
			
		||||
CMD ["php-fpm"]
 | 
			
		||||
@@ -31,6 +31,9 @@ server {
 | 
			
		||||
    client_max_body_size 4G;
 | 
			
		||||
    client_body_timeout 600s;
 | 
			
		||||
    fastcgi_buffers 64 4K;
 | 
			
		||||
    fastcgi_read_timeout 300;
 | 
			
		||||
    fastcgi_send_timeout 300;
 | 
			
		||||
    fastcgi_connect_timeout 300;
 | 
			
		||||
 | 
			
		||||
    # Enable gzip but do not remove ETag headers
 | 
			
		||||
    gzip on;
 | 
			
		||||
 
 | 
			
		||||
@@ -385,7 +385,7 @@ expose_php = On
 | 
			
		||||
; Maximum execution time of each script, in seconds
 | 
			
		||||
; http://php.net/max-execution-time
 | 
			
		||||
; Note: This directive is hardcoded to 0 for the CLI SAPI
 | 
			
		||||
max_execution_time = 30
 | 
			
		||||
max_execution_time = 300
 | 
			
		||||
 | 
			
		||||
; Maximum amount of time each script may spend parsing request data. It's a good
 | 
			
		||||
; idea to limit this time on productions servers in order to eliminate unexpectedly
 | 
			
		||||
@@ -395,7 +395,7 @@ max_execution_time = 30
 | 
			
		||||
; Development Value: 60 (60 seconds)
 | 
			
		||||
; Production Value: 60 (60 seconds)
 | 
			
		||||
; http://php.net/max-input-time
 | 
			
		||||
max_input_time = 60
 | 
			
		||||
max_input_time = 300
 | 
			
		||||
 | 
			
		||||
; Maximum input variable nesting level
 | 
			
		||||
; http://php.net/max-input-nesting-level
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							@@ -9,8 +9,8 @@ services:
 | 
			
		||||
    image: git.shihaam.dev/dockerfiles/nextcloud/fpm:latest
 | 
			
		||||
    hostname: fpm
 | 
			
		||||
    volumes:
 | 
			
		||||
      - nextcloud-config:/var/www/html/config:rw
 | 
			
		||||
      - nextcloud-apps:/var/www/html/apps:rw
 | 
			
		||||
      - ./nextcloud/config:/var/www/html/config:rw
 | 
			
		||||
      - ./nextcloud/apps:/var/www/html/apps:rw
 | 
			
		||||
      - /mnt/vol0/nextcloud-data:/var/www/html/data:rw
 | 
			
		||||
    depends_on:
 | 
			
		||||
      - mysql
 | 
			
		||||
@@ -34,11 +34,7 @@ services:
 | 
			
		||||
      MYSQL_PASSWORD: nextcloud
 | 
			
		||||
      MYSQL_ALLOW_EMPTY_PASSWORD: true
 | 
			
		||||
    volumes:
 | 
			
		||||
      - ./database:/var/lib/mysql
 | 
			
		||||
 | 
			
		||||
volumes:
 | 
			
		||||
  nextcloud-config:
 | 
			
		||||
  nextcloud-apps:
 | 
			
		||||
      - ./nextcloud/database:/var/lib/mysql
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
- You must use a reverse proxy with SSL before starting to setup, personally i use nginx with certbot. \
 | 
			
		||||
@@ -61,5 +57,3 @@ server {
 | 
			
		||||
sudo certbot --nginx -d nextcloud.shihaam.me
 | 
			
		||||
```
 | 
			
		||||
- Configure your DNS accordingly and then.. thats it, enjoy.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user