-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
90 lines (73 loc) · 2.22 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# From https://github.com/juliushaertl/nextcloud-docker-dev/blob/master/docker/Dockerfile.php74
FROM ghcr.io/juliushaertl/nextcloud-dev-php81
# Get other dependencies
RUN apt-get update; \
apt-get install -y --no-install-recommends \
openssl \
nano \
openssh-client \
unzip \
; \
rm -rf /var/lib/apt/lists/*
# Install composer
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer && \
chmod +x /usr/local/bin/composer
# Generate self signed certificate
RUN mkdir -p /certs && \
cd /certs && \
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/C=DE/ST=BE/L=Local/O=Dev/CN=localhost" -keyout ./ssl.key -out ./ssl.crt && \
chmod -R +r ./
# Remove default ports
RUN rm /etc/apache2/ports.conf; \
sed -s -i -e "s/Include ports.conf//" /etc/apache2/apache2.conf; \
sed -i "/^Listen /d" /etc/apache2/apache2.conf
# Enable apache mods
RUN a2enmod rewrite \
headers \
proxy \
proxy_fcgi \
setenvif \
env \
mime \
dir \
authz_core \
alias \
ssl
# Copy apache conf
COPY apache.conf /etc/apache2/sites-available/
# Adjust apache sites
RUN a2dissite 000-default && \
a2dissite default-ssl && \
a2ensite apache.conf
# Copy start script
COPY cron.sh /cron.sh
COPY start.sh /usr/bin/
# Replace occ script with fixed version
COPY occ /usr/local/bin/occ
# Make scripts executable
RUN chmod +x /usr/bin/start.sh; \
chmod +x /usr/local/bin/occ; \
chmod +x /cron.sh
# Correctly set rights and add directories
RUN cd /var/www; \
rm -rf nextcloud; \
mkdir nextcloud; \
chown www-data:www-data -R /var/www
# Switch to www-data user to make container more secure
USER www-data
# Install NVM (Gallium = v16, Hydrogen = v18, Iron = v20)
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/var/www/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/iron \
&& nvm install-latest-npm \
&& nvm install lts/gallium \
&& nvm install-latest-npm \
&& nvm install lts/hydrogen \
&& nvm install-latest-npm
ENV APACHE_PORT 443
# Set entrypoint
ENTRYPOINT ["start.sh"]
# Set CMD
CMD ["apache2-foreground"]