Skip to content

Commit 9204ea9

Browse files
committed
Cleanup Dockerfile
- Fix Hadolinting rules (Do not use ADD) - Combine multiple RUN statements into a single layer - Move COPY statements together - Install composer from a Docker image instead of requiring download
1 parent 6344e9c commit 9204ea9

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

Dockerfile

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
FROM nextcloud:24.0.1
2-
COPY site.conf /etc/apache2/sites-enabled/000-default.conf
3-
RUN a2enmod ssl
4-
RUN mkdir /tls
5-
RUN openssl req -new -x509 -days 365 -nodes \
6-
-out /tls/server.cert \
7-
-keyout /tls/server.key \
8-
-subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=www.example.ro"
2+
93
RUN apt-get update && apt-get install -yq \
10-
git \
11-
vim \
12-
sudo
13-
WORKDIR /install
14-
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
15-
RUN php composer-setup.php
16-
RUN php -r "unlink('composer-setup.php');"
17-
ADD ./solid /usr/src/nextcloud/apps/solid
18-
# Run composer:
19-
WORKDIR /usr/src/nextcloud/apps/solid
20-
RUN ls
21-
RUN php /install/composer.phar update
22-
RUN php /install/composer.phar install --no-dev --prefer-dist
4+
git \
5+
sudo \
6+
vim \
7+
&& rm -rf /var/lib/apt/lists/* \
8+
&& a2enmod ssl \
9+
&& mkdir /tls \
10+
&& openssl req -new -x509 -days 365 -nodes \
11+
-keyout /tls/server.key \
12+
-out /tls/server.cert \
13+
-subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=www.example.ro"
14+
15+
COPY solid/ /usr/src/nextcloud/apps/solid
16+
COPY init.sh /
17+
COPY init-live.sh /
18+
COPY site.conf /etc/apache2/sites-enabled/000-default.conf
19+
20+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
21+
RUN composer install --working-dir=/usr/src/nextcloud/apps/solid --no-dev --prefer-dist \
22+
&& rm /usr/local/bin/composer
23+
2324
WORKDIR /var/www/html
24-
ADD init.sh /
25-
ADD init-live.sh /
2625
EXPOSE 443

0 commit comments

Comments
 (0)