tried to make it as light as possible cause it resulted in an 108m image which is not acceptable
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -4,13 +4,12 @@ FROM alpine:3.22 AS builder
|
||||
ENV PHP_VERSION=8.5.0
|
||||
|
||||
# Build dependencies
|
||||
RUN apk add \
|
||||
RUN apk add --no-cache \
|
||||
build-base autoconf bison re2c \
|
||||
curl tar \
|
||||
libxml2-dev openssl-dev sqlite-dev zlib-dev pcre2-dev libzip-dev oniguruma-dev \
|
||||
postgresql-dev \
|
||||
freetype-dev libpng-dev libjpeg-turbo-dev libwebp-dev \
|
||||
curl-dev krb5-dev
|
||||
curl-dev
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
@@ -39,7 +38,6 @@ RUN ./configure \
|
||||
--with-sqlite3 \
|
||||
--with-pdo-sqlite \
|
||||
--with-pdo-pgsql \
|
||||
--with-pgsql \
|
||||
--with-gd \
|
||||
--with-jpeg \
|
||||
--with-webp \
|
||||
@@ -52,16 +50,23 @@ RUN cp php.ini-production /usr/local/php/php.ini
|
||||
|
||||
# Cleanup
|
||||
RUN rm -rf /tmp/* /var/cache/apk/*
|
||||
RUN rm -rf /usr/local/php/lib/php/build
|
||||
RUN rm -rf /usr/local/php/include
|
||||
RUN rm -rf /usr/local/php/php/man
|
||||
|
||||
# Strip
|
||||
RUN strip --strip-all /usr/local/php/bin/php || true
|
||||
RUN strip --strip-all /usr/local/php/sbin/php-fpm || true
|
||||
RUN find /usr/local/php -name "*.so" -exec strip --strip-unneeded {} \; || true
|
||||
|
||||
# --- Stage 2: Runtime ---
|
||||
FROM alpine:3.22
|
||||
|
||||
# Runtime libraries only
|
||||
RUN apk add \
|
||||
libxml2 openssl sqlite-libs zlib libzip pcre2 oniguruma \
|
||||
postgresql-libs \
|
||||
RUN apk add --no-cache \
|
||||
libxml2 openssl zlib libzip pcre2 oniguruma \
|
||||
freetype libpng libjpeg-turbo libwebp \
|
||||
imap krb5-libs
|
||||
postgresql-libs
|
||||
|
||||
RUN addgroup -S php && adduser -S -D -H -G php php
|
||||
RUN mkdir -p /usr/local/php/conf.d /var/run/php
|
||||
|
||||
Reference in New Issue
Block a user