Files
dev_blog/functions/backup/Containerfile
2026-05-13 20:20:31 -05:00

26 lines
1.0 KiB
Docker

# Use a custom Containerfile to include restic and gsutil
FROM python:3.11-slim
# Suppress debconf warnings and pip root warnings
ENV DEBIAN_FRONTEND=noninteractive \
PIP_ROOT_USER_ACTION=ignore
# Install restic, curl, and gnupg
RUN apt-get update && apt-get install -y --no-install-recommends restic curl gnupg \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list \
&& apt-get update && apt-get install -y --no-install-recommends google-cloud-cli \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
COPY . .
# Cloud Run functions expect a specific entrypoint
ENTRYPOINT ["functions-framework", "--target", "run_backup", "--signature-type", "cloudevent"]