lab4
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# syntax=docker/dockerfile:1.7.0
|
||||
FROM python:3.12.10-slim-bookworm
|
||||
ARG COMPONENT
|
||||
ARG RELEASE
|
||||
ARG SHA256
|
||||
RUN python - <<'PY'
|
||||
import hashlib
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import urllib.request
|
||||
|
||||
component = os.environ['COMPONENT']
|
||||
release = os.environ['RELEASE']
|
||||
assert component in {'minio', 'mc'}
|
||||
name = f'{component}.linux-amd64.{release}'
|
||||
url = f'https://github.com/minio/{component}/releases/download/{release}/{name}'
|
||||
target = Path('/usr/local/bin') / component
|
||||
with urllib.request.urlopen(url, timeout=180) as response, target.open('wb') as file:
|
||||
shutil.copyfileobj(response, file)
|
||||
with target.open('rb') as file:
|
||||
digest = hashlib.file_digest(file, 'sha256').hexdigest()
|
||||
assert digest == os.environ['SHA256'], 'Unexpected binary checksum'
|
||||
target.chmod(0o755)
|
||||
PY
|
||||
COPY infra/minio-entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
|
||||
Reference in New Issue
Block a user