fortawesome-font-awesome
SUCCESS
42m 49s
History Source
SummaryIterations3Transcript42Dockerfile
Dockerfile27 lines · 985 chars
FROM composer:2.9.8

# Install system dependencies (support both Debian-based and Alpine-based images)
RUN set -eux; \
    if command -v apk >/dev/null 2>&1; then \
        apk add --no-cache git unzip curl ca-certificates; \
    elif command -v apt-get >/dev/null 2>&1; then \
        apt-get update && apt-get install -y --no-install-recommends git unzip curl ca-certificates && \
        rm -rf /var/lib/apt/lists/*; \
    else \
        echo "Unsupported base image package manager"; \
        exit 1; \
    fi

WORKDIR /app

# Copy only composer manifest first to leverage Docker cache
COPY --chown=root:root composer.json ./
# If a composer.lock exists, Composer will use it; otherwise Composer will generate the autoloader as needed.
RUN composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader --no-autoloader

# Copy the rest of the source code
COPY --chown=root:root . ./

# Default command: display PHP version as a lightweight check
CMD ["php", "-v"]