refactor(Dockerfile): streamline RUN commands for improved readability and maintainability by adding line continuations

This commit is contained in:
Andras Bacsai
2025-04-13 15:22:00 +02:00
parent 1ab7405e2e
commit 3803bac2aa

View File

@@ -22,7 +22,7 @@ USER root
ARG USER_ID ARG USER_ID
ARG GROUP_ID ARG GROUP_ID
RUN docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID && RUN docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID && \
docker-php-serversideup-set-file-permissions --owner $USER_ID:$GROUP_ID --service nginx docker-php-serversideup-set-file-permissions --owner $USER_ID:$GROUP_ID --service nginx
WORKDIR /var/www/html WORKDIR /var/www/html
@@ -64,13 +64,13 @@ WORKDIR /var/www/html
USER root USER root
RUN docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID && RUN docker-php-serversideup-set-id www-data $USER_ID:$GROUP_ID && \
docker-php-serversideup-set-file-permissions --owner $USER_ID:$GROUP_ID --service nginx docker-php-serversideup-set-file-permissions --owner $USER_ID:$GROUP_ID --service nginx
# Install PostgreSQL repository and keys # Install PostgreSQL repository and keys
RUN apk add --no-cache gnupg && RUN apk add --no-cache gnupg && \
mkdir -p /usr/share/keyrings && mkdir -p /usr/share/keyrings && \
curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor >/usr/share/keyrings/postgresql.gpg curl -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /usr/share/keyrings/postgresql.gpg
# Install system dependencies # Install system dependencies
RUN apk add --no-cache \ RUN apk add --no-cache \
@@ -83,17 +83,17 @@ RUN apk add --no-cache \
vim vim
# Configure shell aliases # Configure shell aliases
RUN echo "alias ll='ls -al'" >>/etc/profile && RUN echo "alias ll='ls -al'" >> /etc/profile && \
echo "alias a='php artisan'" >>/etc/profile && echo "alias a='php artisan'" >> /etc/profile && \
echo "alias logs='tail -f storage/logs/laravel.log'" >>/etc/profile echo "alias logs='tail -f storage/logs/laravel.log'" >> /etc/profile
# Install Cloudflared based on architecture # Install Cloudflared based on architecture
RUN mkdir -p /usr/local/bin && RUN mkdir -p /usr/local/bin && \
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
curl -sSL "https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-amd64" -o /usr/local/bin/cloudflared curl -sSL "https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-amd64" -o /usr/local/bin/cloudflared; \
elif [ "${TARGETPLATFORM}" = "linux/arm64" ]; then elif [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
curl -sSL "https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-arm64" -o /usr/local/bin/cloudflared curl -sSL "https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-arm64" -o /usr/local/bin/cloudflared; \
fi && fi && \
chmod +x /usr/local/bin/cloudflared chmod +x /usr/local/bin/cloudflared
# Configure PHP # Configure PHP
@@ -129,8 +129,8 @@ COPY docker/production/etc/nginx/conf.d/custom.conf /etc/nginx/conf.d/custom.con
COPY docker/production/etc/nginx/site-opts.d/http.conf /etc/nginx/site-opts.d/http.conf COPY docker/production/etc/nginx/site-opts.d/http.conf /etc/nginx/site-opts.d/http.conf
COPY --chmod=755 docker/production/etc/s6-overlay/ /etc/s6-overlay/ COPY --chmod=755 docker/production/etc/s6-overlay/ /etc/s6-overlay/
RUN mkdir -p /etc/nginx/conf.d && RUN mkdir -p /etc/nginx/conf.d && \
chown -R www-data:www-data /etc/nginx && chown -R www-data:www-data /etc/nginx && \
chmod -R 755 /etc/nginx chmod -R 755 /etc/nginx
# Install MinIO client # Install MinIO client