From ac0a1fca97f62b57e9ea103b60b835da45d9addb Mon Sep 17 00:00:00 2001 From: Crossedfall Date: Sun, 19 Nov 2023 20:46:38 -0600 Subject: [PATCH] Migrates the dockerfile to alpine (#65) * Updates Docker to use alpine * Updates the docker action to use v3 * Version bumps --- .github/workflows/docker.yml | 2 +- Dockerfile | 22 ++++++++++------------ pyproject.toml | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 272486d..37e0b6d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -24,7 +24,7 @@ jobs: docker build . --file Dockerfile --tag $IMAGE_NAME --squash - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index 0762be6..5875f53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # For more information, please refer to https://aka.ms/vscode-docker-python -FROM python:3.11-slim-bullseye as base +FROM python:3.11-alpine as base # Keeps Python from generating .pyc files in the container # Turns off buffering for easier container logging @@ -7,31 +7,29 @@ FROM python:3.11-slim-bullseye as base ENV PYTHONFAULTHANDLER=1 \ PYTHONHASHSEED=random \ PYTHONUNBUFFERED=1 \ - POETRY_VERSION=1.6.1 \ + POETRY_VERSION=1.7.1 \ POETRY_VIRTUALENVS_CREATE=false \ PYTHONDONTWRITEBYTECODE=1 COPY ["poetry.lock", "pyproject.toml", "./"] -RUN apt-get update && \ - apt-get install -y --no-install-recommends default-libmysqlclient-dev gcc git && \ - pip install "poetry==$POETRY_VERSION" +RUN apk add --no-cache mariadb-dev \ + && apk add --no-cache --virtual build-dependencies gcc git libc-dev linux-headers \ + && pip install --no-cache-dir "poetry==$POETRY_VERSION" # Install pip requirements -RUN poetry install --without=dev --no-root --no-interaction --no-ansi - -RUN apt-get autoremove gcc git --purge -y && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /root/.cache +RUN poetry install --without=dev --no-root --no-interaction --no-ansi \ + && apk del --purge build-dependencies COPY server-conf/beesite_uwsgi.ini /etc/uwsgi/uwsgi.ini WORKDIR /app COPY /src /app -RUN gzip --keep --best --force --recursive /app/beesite/static/ && \ - chown -R www-data:www-data /app +RUN gzip -k --best --force /app/beesite/static/ \ + && adduser -u 82 -D -S -G www-data www-data \ + && chown -R www-data:www-data /app USER www-data:www-data diff --git a/pyproject.toml b/pyproject.toml index b576171..f6e6c1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "beesite" -version = "2.0.0" +version = "2.1.0" description = "BeeStation13 Website" authors = ["Qwertyquerty", "Crossedfall"] license = "APACHE"