Skip to content

Commit 31a4e29

Browse files
committed
Apply COPY vs ADD best practices
Should only use `ADD` for URLs (and even then, `curl` or `wget` are preferred, for numerous reasons, even within this repo) and when extracting archive contents as part of the `ADD` operation; otherwise `COPY` is clearer and (slightly) more efficient.
1 parent 067218e commit 31a4e29

15 files changed

Lines changed: 24 additions & 24 deletions

File tree

aerospike/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ LABEL maintainer="Luciano Jr <luciano@lucianojr.com.br>"
44

55
RUN rm /etc/aerospike/aerospike.conf
66

7-
ADD aerospike.conf /etc/aerospike/aerospike.conf
7+
COPY aerospike.conf /etc/aerospike/aerospike.conf

hhvm/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN apt-get update -y \
1515

1616
RUN mkdir -p /var/www
1717

18-
ADD server.ini /etc/hhvm/server.ini
18+
COPY server.ini /etc/hhvm/server.ini
1919

2020
RUN usermod -u 1000 www-data
2121

mariadb/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM mariadb:latest
22

33
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
44

5-
ADD my.cnf /etc/mysql/conf.d/my.cnf
5+
COPY my.cnf /etc/mysql/conf.d/my.cnf
66

77
CMD ["mysqld"]
88

mysql/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
1313

1414
RUN chown -R mysql:root /var/lib/mysql/
1515

16-
ADD my.cnf /etc/mysql/conf.d/my.cnf
16+
COPY my.cnf /etc/mysql/conf.d/my.cnf
1717

1818
CMD ["mysqld"]
1919

nginx/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM nginx:alpine
22

33
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
44

5-
ADD nginx.conf /etc/nginx/
5+
COPY nginx.conf /etc/nginx/
66

77
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
88

percona/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LABEL maintainer="DTUNES <diegotdai@gmai.com>"
44

55
RUN chown -R mysql:root /var/lib/mysql/
66

7-
ADD my.cnf /etc/mysql/conf.d/my.cnf
7+
COPY my.cnf /etc/mysql/conf.d/my.cnf
88

99
CMD ["mysqld"]
1010

php-fpm/Dockerfile-56

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ RUN php -v | head -n 1 | grep -q "PHP 5.6."
358358
#--------------------------------------------------------------------------
359359
#
360360

361-
ADD ./laravel.ini /usr/local/etc/php/conf.d
362-
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
361+
COPY ./laravel.ini /usr/local/etc/php/conf.d
362+
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
363363

364364
#RUN rm -r /var/lib/apt/lists/*
365365

php-fpm/Dockerfile-70

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ RUN php -v | head -n 1 | grep -q "PHP 7.0."
380380
#--------------------------------------------------------------------------
381381
#
382382

383-
ADD ./laravel.ini /usr/local/etc/php/conf.d/
384-
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
383+
COPY ./laravel.ini /usr/local/etc/php/conf.d/
384+
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
385385

386386
#RUN rm -r /var/lib/apt/lists/*
387387

php-fpm/Dockerfile-71

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ RUN php -v | head -n 1 | grep -q "PHP 7.1."
380380
#--------------------------------------------------------------------------
381381
#
382382

383-
ADD ./laravel.ini /usr/local/etc/php/conf.d
384-
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
383+
COPY ./laravel.ini /usr/local/etc/php/conf.d
384+
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
385385

386386
#RUN rm -r /var/lib/apt/lists/*
387387

php-fpm/Dockerfile-72

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ RUN php -v | head -n 1 | grep -q "PHP 7.2."
383383
#--------------------------------------------------------------------------
384384
#
385385

386-
ADD ./laravel.ini /usr/local/etc/php/conf.d
387-
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
386+
COPY ./laravel.ini /usr/local/etc/php/conf.d
387+
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
388388

389389
#RUN rm -r /var/lib/apt/lists/*
390390

0 commit comments

Comments
 (0)