Skip to content

Instantly share code, notes, and snippets.

@radityopw
Created July 20, 2025 14:22
Show Gist options
  • Save radityopw/41a49b06d8707923b6e3f134d89878b7 to your computer and use it in GitHub Desktop.
Save radityopw/41a49b06d8707923b6e3f134d89878b7 to your computer and use it in GitHub Desktop.
Docker file untuk GCP php 8.3 versi CLI dengan ext grpc dan protobuf, digunakan untuk cloud run job
# Use the official PHP image.
# https://hub.docker.com/_/php
FROM php:8.3-cli
# Menginstal dependensi yang diperlukan untuk ekstensi PHP
# Pastikan untuk membersihkan cache APT setelah instalasi untuk menjaga ukuran image tetap kecil
RUN apt-get update && apt-get install -y libcurl4-openssl-dev autoconf zlib1g-dev && rm -rf /var/lib/apt/lists/*
# Menginstal ekstensi PHP curl
RUN docker-php-ext-install curl
# Configure PHP for Cloud Run.
# Precompile PHP code with opcache.
RUN docker-php-ext-install -j "$(nproc)" opcache
RUN set -ex; \
{ \
echo "; Cloud Run enforces memory & timeouts"; \
echo "memory_limit = -1"; \
echo "max_execution_time = 0"; \
echo "; File upload at Cloud Run network limit"; \
echo "upload_max_filesize = 32M"; \
echo "post_max_size = 32M"; \
echo "; Configure Opcache for Containers"; \
echo "opcache.enable = On"; \
echo "opcache.validate_timestamps = Off"; \
echo "; Configure Opcache Memory (Application-specific)"; \
echo "opcache.memory_consumption = 32"; \
} > "$PHP_INI_DIR/conf.d/cloud-run.ini"
RUN pecl install protobuf \
&& docker-php-ext-enable protobuf
RUN pecl install grpc \
&& docker-php-ext-enable grpc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment