From 117605e3ff2c6111a2233313b354e30729027998 Mon Sep 17 00:00:00 2001 From: TaylorTWBrown Date: Tue, 13 Aug 2024 02:06:10 +0900 Subject: [PATCH] Update Dockerfile and Actions Update resources Build for all branches Always run CI Update GH Action Update Docker creds Use debian 12.6 Use a venv to deal with pip More refining Add GHCR --- .github/workflows/docker-image.yml | 33 ++++++++++++++---------------- Dockerfile | 33 +++++++++++++++++------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index ddca910..0c6f00e 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -2,11 +2,6 @@ name: ci on: push: - branches: - - 'master' - tags: - - '*.*.*' - - '*.*.*_*.*.*' jobs: @@ -16,27 +11,29 @@ jobs: steps: - name: Set up Docker Buildx id: build - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: - username: ${{ github.repository_owner }} + username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: push: true - platforms: linux/amd64 tags: | - ${{ github.repository_owner }}/ombi_sqlite_mysql:${{ github.ref_name }} - ${{ github.repository_owner }}/ombi_sqlite_mysql:latest + ${{ secrets.DOCKERHUB_USERNAME }}/ombi_sqlite_mysql:${{ github.ref_name }} + ${{ secrets.DOCKERHUB_USERNAME }}/ombi_sqlite_mysql:latest + ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/ombi_sqlite_mysql:${{ github.ref_name }} + ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/ombi_sqlite_mysql:latest build_args: OMBI_VER=${{ github.ref_name }} - - - - - - diff --git a/Dockerfile b/Dockerfile index 83615a8..6a1c9eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,24 @@ -FROM --platform=$BUILDPLATFORM debian:11.3 -# FROM debian:11.3 +FROM --platform=$BUILDPLATFORM debian:12.6 +# FROM debian:12.6 LABEL version="1.0" maintainer="vsc55@cerebelum.net" description="Docker Ombi Data Base Migration Tools" RUN \ - apt-get update && \ - apt-get install -y python3 python3-pip libmariadb-dev git libicu-dev && \ - pip3 install --no-cache-dir --upgrade pip && \ - pip3 install --no-cache-dir mysqlclient packaging && \ - apt-get clean autoclean && \ - apt-get autoremove --yes && \ - rm -rf /var/lib/{apt,dpkg,cache,log}/ + apt-get update && \ + apt-get install -y python3 python3-pip libmariadb-dev git libicu-dev python3-venv pkg-config && \ + apt-get clean autoclean && \ + apt-get autoremove --yes && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ + +# Create a virtual environment +RUN python3 -m venv /opt/venv + +# Activate the virtual environment and install Python packages +RUN /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ + /opt/venv/bin/pip install --no-cache-dir mysqlclient packaging + +# Ensure the virtual environment is activated for subsequent commands +ENV PATH="/opt/venv/bin:$PATH" WORKDIR / COPY --chown=root:root /rootfs / @@ -18,10 +26,7 @@ COPY --chown=root:root /rootfs / WORKDIR /opt/ombi_sqlite_mysql COPY --chown=root:root ["ombi_sqlite2mysql.py", "ombi_sqlite2mysql_multi.py", "./"] -#Fix, hub.docker.com auto buils +# Fix, hub.docker.com auto builds RUN chmod +x /opt/ombi_sqlite_mysql/*.py /opt/ombi_sqlite_mysql/*.sh -ENV HTTP_PORT=5000 - -VOLUME ["/config", "/opt/ombi"] -EXPOSE ${HTTP_PORT}/tcp +ENV HTTP_PORT=5000 \ No newline at end of file