Skip to content

Commit

Permalink
drop alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
w0rng committed Jun 18, 2024
1 parent 56fa52c commit e1e4d85
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ updates:
patterns:
- "*"
- package-ecosystem: "docker"
directory: "/python.alpine"
directory: "/python.debian"
schedule:
interval: "monthly"
43 changes: 6 additions & 37 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,6 @@ on:
branches: [ 'main' ]

jobs:
build_python_alpine:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: set up QEMU
uses: docker/setup-qemu-action@v3

- name: set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: build python
env:
GITHUB_PACKAGE_TOKEN: ${{ secrets.GITHUBPKG }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
USERNAME: ${{ github.actor }}
GITHUB_SHA: ${{ github.sha}}
GITHUB_REF: ${{ github.ref}}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
echo ${DOCKER_HUB_TOKEN} | docker login -u ${USERNAME} --password-stdin
docker buildx build --push --platform linux/amd64,linux/arm/v7,linux/arm64 \
-t ghcr.io/${USERNAME}/baseimage/python3.12-alpine:latest -t ${USERNAME}/baseimage:python3.12-alpine-latest \
python.alpine -f python.alpine/Dockerfile
build_python_bebian:
runs-on: ubuntu-latest
steps:
Expand All @@ -57,14 +25,15 @@ jobs:
env:
GITHUB_PACKAGE_TOKEN: ${{ secrets.GITHUBPKG }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
PYTHON_VERSION: ${{ secrets.PYTHON_VERSION }}
USERNAME: ${{ github.actor }}
GITHUB_SHA: ${{ github.sha}}
GITHUB_REF: ${{ github.ref}}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
echo ${DOCKER_HUB_TOKEN} | docker login -u ${USERNAME} --password-stdin
docker buildx build --push --platform linux/amd64,linux/arm/v7,linux/arm64 \
-t ghcr.io/${USERNAME}/baseimage/python3.12-debian:latest -t ${USERNAME}/baseimage:python3.12-debian-latest \
python.debian -f python.debian/Dockerfile
docker buildx build --push --platform linux/amd64,linux/arm/v7 \
-t ghcr.io/${USERNAME}/python:${PYTHON_VERSION} -t ${USERNAME}/python:${PYTHON_VERSION} \
python -f python/Dockerfile
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

_персональные docker images_

## python.alpine
## python

Images `w0rng/baseimage:python3.12-alpine-latest` и `ghcr.io/w0rng/baseimage/python3.12-alpine:latest`
Images `w0rng/python:3.12` и `ghcr.io/w0rng/python:3.12`

* `pip` заменен на `uv` (вы этого не заметите)
* установлен `bash` и `curl`
Expand All @@ -20,12 +20,6 @@ Images `w0rng/baseimage:python3.12-alpine-latest` и `ghcr.io/w0rng/baseimage/py
* `APP_UID` - UID внутреннего пользователя приложения, по умолчанию 1001
* `TIME_ZONE` - таймзона контейнера, по умолчанию "Europe/Moscow"

## python.debian
Все тоже самое, но на основе `python3.12-slim`

Images `w0rng/baseimage:python3.12-debian-latest` и `ghcr.io/w0rng/baseimage/python3.12-debian:latest`


## License

This project includes work from the following project(s) licensed under the MIT License:
Expand Down
35 changes: 0 additions & 35 deletions python.alpine/Dockerfile

This file was deleted.

41 changes: 0 additions & 41 deletions python.alpine/init.sh

This file was deleted.

3 changes: 0 additions & 3 deletions python.alpine/pip.sh

This file was deleted.

23 changes: 14 additions & 9 deletions python.debian/Dockerfile → python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM python:3.12-slim
ARG PYTHON_VERSION=3.12

FROM python:${PYTHON_VERSION}-slim

LABEL org.opencontainers.image.authors="w0rng <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/w0rng/baseimage/"
Expand All @@ -9,17 +11,20 @@ ENV TIME_ZONE=Europe/Moscow \
APP_USER=app \
APP_UID=1001

COPY ./init.sh /init.sh
COPY ./pip.sh /pip
COPY --chmod=111 ./init.sh /init.sh
COPY --chmod=111 ./pip.sh /pip

SHELL ["/bin/bash", "-exo", "pipefail", "-c" ]

RUN chmod +x /init.sh /pip && \
apt update && apt --no-install-recommends install -y dumb-init curl && rm -rf /var/lib/apt/lists/* && \
RUN apt update && apt --no-install-recommends install -y dumb-init curl && rm -rf /var/lib/apt/lists/* && \
mkdir -p /home/$APP_USER && \
adduser --shell /bin/bash --uid $APP_UID $APP_USER && chown -R $APP_USER:$APP_USER /home/$APP_USER && \
ln -s /usr/bin/dumb-init /sbin/dinit && \
ln -s /usr/bin/dumb-init /sbin/dinit

RUN adduser --shell /bin/bash --uid $APP_UID $APP_USER && chown -R $APP_USER:$APP_USER /home/$APP_USER && \
mkdir -p /app && chown -R $APP_USER:$APP_USER /app && \
pip install --upgrade --no-cache-dir pip setuptools uv && \
mkdir -p ${VIRTUAL_ENV} && chown -R $APP_USER:$APP_USER ${VIRTUAL_ENV} && \
mkdir -p ${VIRTUAL_ENV} && chown -R $APP_USER:$APP_USER ${VIRTUAL_ENV}

RUN pip install --upgrade --no-cache-dir pip setuptools uv && \
uv venv ${VIRTUAL_ENV} && \
rm /usr/local/bin/pip && \
mv /pip /usr/local/bin/pip && \
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit e1e4d85

Please sign in to comment.