t commited on
Commit
1e864f5
·
1 Parent(s): e8ba4ff
Files changed (5) hide show
  1. Dockerfile +11 -20
  2. nginx.conf +12 -10
  3. php-fpm.conf +9 -0
  4. start.sh +1 -2
  5. supervisor.conf +2 -7
Dockerfile CHANGED
@@ -2,40 +2,32 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Install system packages and PHP + Cockpit
6
  RUN apt update && apt install -y \
7
- tzdata \
8
- nginx \
9
- supervisor \
10
- systemd \
11
  cockpit cockpit-networkmanager cockpit-packagekit cockpit-storaged \
12
- php php-fpm php-curl php-xml php-mbstring php-gd php-zip php-sqlite3 \
 
 
13
  curl unzip passwd
14
 
15
- # Set timezone non-interactive
16
  ENV TZ=Asia/Kolkata
17
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
18
 
19
- # Create admin user for Cockpit
20
  RUN useradd -m admin && echo "admin:admin" | chpasswd && usermod -aG sudo admin
21
 
22
- # Prepare cockpit runtime folder
23
- RUN mkdir -p /run/cockpit
24
-
25
- # Preload cockpit bridge (not required but useful)
26
- RUN /usr/lib/cockpit/cockpit-bridge --version || true
27
-
28
- # Workspace
29
- RUN mkdir -p /workspace
30
 
31
  # Install Nextcloud
32
  RUN curl -L https://download.nextcloud.com/server/releases/latest.zip -o nextcloud.zip \
33
- && unzip nextcloud.zip -d /workspace \
34
  && rm nextcloud.zip \
35
- && chown -R www-data:www-data /workspace/nextcloud
36
 
37
- # Copy configs
38
  COPY nginx.conf /etc/nginx/nginx.conf
 
39
  COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
40
  COPY start.sh /start.sh
41
  RUN chmod +x /start.sh
@@ -44,4 +36,3 @@ EXPOSE 7860
44
 
45
  CMD ["/start.sh"]
46
 
47
-
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
 
5
  RUN apt update && apt install -y \
6
+ tzdata nginx supervisor systemd \
 
 
 
7
  cockpit cockpit-networkmanager cockpit-packagekit cockpit-storaged \
8
+ php8.1 php8.1-fpm \
9
+ php8.1-curl php8.1-xml php8.1-mbstring php8.1-gd php8.1-zip \
10
+ php8.1-sqlite3 php8.1-intl php8.1-opcache php8.1-readline php8.1-fileinfo \
11
  curl unzip passwd
12
 
13
+ # Timezone
14
  ENV TZ=Asia/Kolkata
15
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
16
 
17
+ # Create admin user
18
  RUN useradd -m admin && echo "admin:admin" | chpasswd && usermod -aG sudo admin
19
 
20
+ # Nextcloud dir
21
+ RUN mkdir -p /var/www/nextcloud
 
 
 
 
 
 
22
 
23
  # Install Nextcloud
24
  RUN curl -L https://download.nextcloud.com/server/releases/latest.zip -o nextcloud.zip \
25
+ && unzip nextcloud.zip -d /var/www \
26
  && rm nextcloud.zip \
27
+ && chown -R www-data:www-data /var/www/nextcloud
28
 
 
29
  COPY nginx.conf /etc/nginx/nginx.conf
30
+ COPY php-fpm.conf /etc/php/8.1/fpm/pool.d/www.conf
31
  COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
32
  COPY start.sh /start.sh
33
  RUN chmod +x /start.sh
 
36
 
37
  CMD ["/start.sh"]
38
 
 
nginx.conf CHANGED
@@ -4,24 +4,26 @@ http {
4
  server {
5
  listen 7860;
6
 
7
- # -------- Nextcloud --------
 
 
 
8
  location / {
9
- proxy_pass http://localhost:8080;
10
- proxy_set_header Host $host;
11
- proxy_set_header X-Real-IP $remote_addr;
 
 
 
12
  }
13
 
14
- # -------- Cockpit (on /cockpit/) --------
15
  location /cockpit/ {
16
  proxy_pass http://localhost:9090/;
17
- proxy_http_version 1.1;
18
  proxy_buffering off;
 
19
  proxy_set_header Host $host;
20
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
21
- proxy_set_header Upgrade $http_upgrade;
22
- proxy_set_header Connection $connection_upgrade;
23
  }
24
  }
25
  }
26
 
27
-
 
4
  server {
5
  listen 7860;
6
 
7
+ # ---- Nextcloud ----
8
+ root /var/www/nextcloud/;
9
+ index index.php;
10
+
11
  location / {
12
+ try_files $uri $uri/ /index.php;
13
+ }
14
+
15
+ location ~ \.php$ {
16
+ include snippets/fastcgi-php.conf;
17
+ fastcgi_pass unix:/run/php/php8.1-fpm.sock;
18
  }
19
 
20
+ # ---- Cockpit ----
21
  location /cockpit/ {
22
  proxy_pass http://localhost:9090/;
 
23
  proxy_buffering off;
24
+ proxy_http_version 1.1;
25
  proxy_set_header Host $host;
 
 
 
26
  }
27
  }
28
  }
29
 
 
php-fpm.conf ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [www]
2
+ user = www-data
3
+ group = www-data
4
+ listen = /run/php/php8.1-fpm.sock
5
+ listen.owner = www-data
6
+ listen.group = www-data
7
+ pm = dynamic
8
+ pm.max_children = 5
9
+
start.sh CHANGED
@@ -1,5 +1,4 @@
1
  #!/bin/bash
2
-
3
- # Start supervisor (which starts everything else)
4
  exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf
5
 
 
1
  #!/bin/bash
2
+ mkdir -p /run/php
 
3
  exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf
4
 
supervisor.conf CHANGED
@@ -6,8 +6,8 @@ command=/usr/sbin/php-fpm8.1 -F
6
  autostart=true
7
  autorestart=true
8
 
9
- [program:nextcloud]
10
- command=php -S 0.0.0.0:8080 -t /workspace/nextcloud
11
  autostart=true
12
  autorestart=true
13
 
@@ -16,8 +16,3 @@ command=/usr/lib/cockpit/cockpit-ws --port 9090 --no-tls
16
  autostart=true
17
  autorestart=true
18
 
19
- [program:nginx]
20
- command=nginx -g "daemon off;"
21
- autostart=true
22
- autorestart=true
23
-
 
6
  autostart=true
7
  autorestart=true
8
 
9
+ [program:nginx]
10
+ command=nginx -g "daemon off;"
11
  autostart=true
12
  autorestart=true
13
 
 
16
  autostart=true
17
  autorestart=true
18