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.
This commit is contained in:
parent
067218e010
commit
31a4e29c81
@ -4,4 +4,4 @@ LABEL maintainer="Luciano Jr <luciano@lucianojr.com.br>"
|
|||||||
|
|
||||||
RUN rm /etc/aerospike/aerospike.conf
|
RUN rm /etc/aerospike/aerospike.conf
|
||||||
|
|
||||||
ADD aerospike.conf /etc/aerospike/aerospike.conf
|
COPY aerospike.conf /etc/aerospike/aerospike.conf
|
||||||
|
@ -15,7 +15,7 @@ RUN apt-get update -y \
|
|||||||
|
|
||||||
RUN mkdir -p /var/www
|
RUN mkdir -p /var/www
|
||||||
|
|
||||||
ADD server.ini /etc/hhvm/server.ini
|
COPY server.ini /etc/hhvm/server.ini
|
||||||
|
|
||||||
RUN usermod -u 1000 www-data
|
RUN usermod -u 1000 www-data
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ FROM mariadb:latest
|
|||||||
|
|
||||||
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
|
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
|
||||||
|
|
||||||
ADD my.cnf /etc/mysql/conf.d/my.cnf
|
COPY my.cnf /etc/mysql/conf.d/my.cnf
|
||||||
|
|
||||||
CMD ["mysqld"]
|
CMD ["mysqld"]
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|||||||
|
|
||||||
RUN chown -R mysql:root /var/lib/mysql/
|
RUN chown -R mysql:root /var/lib/mysql/
|
||||||
|
|
||||||
ADD my.cnf /etc/mysql/conf.d/my.cnf
|
COPY my.cnf /etc/mysql/conf.d/my.cnf
|
||||||
|
|
||||||
CMD ["mysqld"]
|
CMD ["mysqld"]
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ FROM nginx:alpine
|
|||||||
|
|
||||||
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
|
LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
|
||||||
|
|
||||||
ADD nginx.conf /etc/nginx/
|
COPY nginx.conf /etc/nginx/
|
||||||
|
|
||||||
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
|
# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ LABEL maintainer="DTUNES <diegotdai@gmai.com>"
|
|||||||
|
|
||||||
RUN chown -R mysql:root /var/lib/mysql/
|
RUN chown -R mysql:root /var/lib/mysql/
|
||||||
|
|
||||||
ADD my.cnf /etc/mysql/conf.d/my.cnf
|
COPY my.cnf /etc/mysql/conf.d/my.cnf
|
||||||
|
|
||||||
CMD ["mysqld"]
|
CMD ["mysqld"]
|
||||||
|
|
||||||
|
@ -358,8 +358,8 @@ RUN php -v | head -n 1 | grep -q "PHP 5.6."
|
|||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
||||||
ADD ./laravel.ini /usr/local/etc/php/conf.d
|
COPY ./laravel.ini /usr/local/etc/php/conf.d
|
||||||
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||||
|
|
||||||
#RUN rm -r /var/lib/apt/lists/*
|
#RUN rm -r /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
@ -380,8 +380,8 @@ RUN php -v | head -n 1 | grep -q "PHP 7.0."
|
|||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
||||||
ADD ./laravel.ini /usr/local/etc/php/conf.d/
|
COPY ./laravel.ini /usr/local/etc/php/conf.d/
|
||||||
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||||
|
|
||||||
#RUN rm -r /var/lib/apt/lists/*
|
#RUN rm -r /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
@ -380,8 +380,8 @@ RUN php -v | head -n 1 | grep -q "PHP 7.1."
|
|||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
||||||
ADD ./laravel.ini /usr/local/etc/php/conf.d
|
COPY ./laravel.ini /usr/local/etc/php/conf.d
|
||||||
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||||
|
|
||||||
#RUN rm -r /var/lib/apt/lists/*
|
#RUN rm -r /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
@ -383,8 +383,8 @@ RUN php -v | head -n 1 | grep -q "PHP 7.2."
|
|||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
||||||
ADD ./laravel.ini /usr/local/etc/php/conf.d
|
COPY ./laravel.ini /usr/local/etc/php/conf.d
|
||||||
ADD ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
|
||||||
|
|
||||||
#RUN rm -r /var/lib/apt/lists/*
|
#RUN rm -r /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ ENV VARNISH_PORT 6081
|
|||||||
ENV BACKEND_HOST localhost
|
ENV BACKEND_HOST localhost
|
||||||
ENV BACKEND_PORT 80
|
ENV BACKEND_PORT 80
|
||||||
|
|
||||||
ADD default.vcl /etc/varnish/default.vcl
|
COPY default.vcl /etc/varnish/default.vcl
|
||||||
ADD start.sh /etc/varnish/start.sh
|
COPY start.sh /etc/varnish/start.sh
|
||||||
|
|
||||||
RUN chmod +x /etc/varnish/start.sh
|
RUN chmod +x /etc/varnish/start.sh
|
||||||
|
|
||||||
|
@ -209,8 +209,8 @@ RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
|
|||||||
ARG INSTALL_WORKSPACE_SSH=false
|
ARG INSTALL_WORKSPACE_SSH=false
|
||||||
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
||||||
|
|
||||||
ADD insecure_id_rsa /tmp/id_rsa
|
COPY insecure_id_rsa /tmp/id_rsa
|
||||||
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
|
COPY insecure_id_rsa.pub /tmp/id_rsa.pub
|
||||||
|
|
||||||
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
||||||
rm -f /etc/service/sshd/down && \
|
rm -f /etc/service/sshd/down && \
|
||||||
|
@ -206,8 +206,8 @@ RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
|
|||||||
ARG INSTALL_WORKSPACE_SSH=false
|
ARG INSTALL_WORKSPACE_SSH=false
|
||||||
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
||||||
|
|
||||||
ADD insecure_id_rsa /tmp/id_rsa
|
COPY insecure_id_rsa /tmp/id_rsa
|
||||||
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
|
COPY insecure_id_rsa.pub /tmp/id_rsa.pub
|
||||||
|
|
||||||
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
||||||
rm -f /etc/service/sshd/down && \
|
rm -f /etc/service/sshd/down && \
|
||||||
|
@ -202,8 +202,8 @@ RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
|
|||||||
ARG INSTALL_WORKSPACE_SSH=false
|
ARG INSTALL_WORKSPACE_SSH=false
|
||||||
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
||||||
|
|
||||||
ADD insecure_id_rsa /tmp/id_rsa
|
COPY insecure_id_rsa /tmp/id_rsa
|
||||||
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
|
COPY insecure_id_rsa.pub /tmp/id_rsa.pub
|
||||||
|
|
||||||
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
||||||
rm -f /etc/service/sshd/down && \
|
rm -f /etc/service/sshd/down && \
|
||||||
|
@ -203,8 +203,8 @@ RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
|
|||||||
ARG INSTALL_WORKSPACE_SSH=false
|
ARG INSTALL_WORKSPACE_SSH=false
|
||||||
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
|
||||||
|
|
||||||
ADD insecure_id_rsa /tmp/id_rsa
|
COPY insecure_id_rsa /tmp/id_rsa
|
||||||
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
|
COPY insecure_id_rsa.pub /tmp/id_rsa.pub
|
||||||
|
|
||||||
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
|
||||||
rm -f /etc/service/sshd/down && \
|
rm -f /etc/service/sshd/down && \
|
||||||
|
Loading…
Reference in New Issue
Block a user