Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Docker ignore file to reduce build context size

# Temp files
*~
~*
.*~
\#*
.#*
*#
dist

# Build files
build
dist
pkg
*.egg
*.egg-info

# Debian Files
debian/files
debian/python-github-backup*

# Sphinx build
doc/_build

# Generated man page
doc/github_backup.1

# Annoying macOS files
.DS_Store
._*

# IDE configuration files
.vscode
.atom
.idea
*.code-workspace

# RSA
id_rsa
id_rsa.pub

# Virtual env
venv
.venv

# Git
.git
.gitignore
.gitchangelog.rc
.github

# Documentation
*.md
!README.md

# Environment variables files
.env
.env.*
!.env.example
*.log

# Cache files
**/__pycache__/
*.py[cod]

# Docker files
docker-compose.yml
Dockerfile*

# Other files
release
*.tar
*.zip
*.gzip
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.py[oc]
*.py[cod]

# Temp files
*~
Expand Down Expand Up @@ -33,6 +33,7 @@ doc/github_backup.1
# IDE configuration files
.vscode
.atom
.idea

README

Expand All @@ -42,3 +43,4 @@ id_rsa.pub

# Virtual env
venv
.venv
42 changes: 32 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
FROM python:3.9.18-slim
FROM python:3.12-alpine3.22 AS builder

RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y git git-lfs
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir uv

WORKDIR /usr/src/app
WORKDIR /app

COPY release-requirements.txt .
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r release-requirements.txt
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
--mount=type=bind,source=release-requirements.txt,target=release-requirements.txt \
uv venv \
&& uv pip install -r release-requirements.txt

COPY . .
RUN --mount=type=cache,target=/root/.cache/pip \
pip install .

ENTRYPOINT [ "github-backup" ]
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install .


FROM python:3.12-alpine3.22
ENV PYTHONUNBUFFERED=1

RUN apk add --no-cache \
ca-certificates \
git \
git-lfs \
&& addgroup -g 1000 appuser \
&& adduser -D -u 1000 -G appuser appuser

COPY --from=builder --chown=appuser:appuser /app /app

WORKDIR /app

USER appuser

ENV PATH="/app/.venv/bin:$PATH"

ENTRYPOINT ["github-backup"]