mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-05 16:18:02 +01:00
chore: update Dockerfile to use Python 3.12 and improve dependency installation
This commit is contained in:
75
.dockerignore
Normal file
75
.dockerignore
Normal file
@@ -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
.gitignore
vendored
4
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
*.py[oc]
|
*.py[cod]
|
||||||
|
|
||||||
# Temp files
|
# Temp files
|
||||||
*~
|
*~
|
||||||
@@ -33,6 +33,7 @@ doc/github_backup.1
|
|||||||
# IDE configuration files
|
# IDE configuration files
|
||||||
.vscode
|
.vscode
|
||||||
.atom
|
.atom
|
||||||
|
.idea
|
||||||
|
|
||||||
README
|
README
|
||||||
|
|
||||||
@@ -42,3 +43,4 @@ id_rsa.pub
|
|||||||
|
|
||||||
# Virtual env
|
# Virtual env
|
||||||
venv
|
venv
|
||||||
|
.venv
|
||||||
|
|||||||
42
Dockerfile
42
Dockerfile
@@ -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 \
|
RUN pip install --no-cache-dir --upgrade pip \
|
||||||
apt-get update && apt-get install -y git git-lfs
|
&& pip install --no-cache-dir uv
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY release-requirements.txt .
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
--mount=type=bind,source=requirements.txt,target=requirements.txt \
|
||||||
pip install -r release-requirements.txt
|
--mount=type=bind,source=release-requirements.txt,target=release-requirements.txt \
|
||||||
|
uv venv \
|
||||||
|
&& uv pip install -r release-requirements.txt
|
||||||
|
|
||||||
COPY . .
|
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"]
|
||||||
|
|||||||
Reference in New Issue
Block a user