diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..7975747 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,34 @@ +FROM python:3.8-slim-bookworm +ENV POETRY_VERSION=1.8.3 \ + VIRTUAL_ENV=/venv \ + POETRY_HOME="/opt/poetry" \ + POETRY_NO_INTERACTION=1 \ + POETRY_VIRTUALENVS_CREATE=false + +RUN apt-get update && apt-get install -y \ + curl \ + binutils \ + git \ + nano \ + python3-tk + +ARG USERNAME=inbac +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +RUN mkdir -p $POETRY_HOME +RUN chown $USER_UID:$USER_GID $POETRY_HOME + +RUN mkdir -p $VIRTUAL_ENV +RUN chown $USER_UID:$USER_GID $VIRTUAL_ENV + +USER $USERNAME + +ENV PATH="$POETRY_HOME/bin:$VIRTUAL_ENV/bin:$PATH" + +RUN python -m venv $VIRTUAL_ENV +RUN curl -sSL https://install.python-poetry.org | python - \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..a44fd18 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,18 @@ +{ + "name": "Inbac", + "build": { + "dockerfile": "Dockerfile" + }, + + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "cat /etc/os-release", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python" + ] + } + } +} diff --git a/.dockerignore b/.dockerignore index 826d9db..750d397 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,4 @@ Dockerfile -LICENSE -README.md .gitignore .vscode/ .github/ diff --git a/Dockerfile b/Dockerfile index d57d731..ef5b7ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,40 @@ -FROM debian:12-slim AS build -ARG POETRY_VERSION=1.8.3 - -RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \ - python3-venv libpython3-dev && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - python3 -m venv /venv && \ - /venv/bin/pip install --upgrade pip setuptools && \ - /venv/bin/pip install poetry==${POETRY_VERSION} +FROM python:3.8-slim-bookworm AS build +ENV POETRY_VERSION=1.8.3 \ + VIRTUAL_ENV=/venv \ + POETRY_HOME="/opt/poetry" \ + POETRY_NO_INTERACTION=1 \ + POETRY_VIRTUALENVS_CREATE=false + +RUN apt-get update && apt-get install -y \ + curl \ + binutils \ + python3-tk + +ENV PATH="$POETRY_HOME/bin:$VIRTUAL_ENV/bin:$PATH" + +RUN python -m venv $VIRTUAL_ENV +RUN curl -sSL https://install.python-poetry.org | python - + +WORKDIR /app + +COPY . . + +RUN poetry install && poetry run pyinstaller --onefile --windowed --hidden-import='PIL._tkinter_finder' inbac/inbac.py + + +FROM debian:12-slim +RUN apt-get update && apt-get install -y\ + libxcb1 fonts-recommended + +ARG USERNAME=inbac +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +COPY --from=build --chown=$USER_UID:$USER_GID /app/dist/inbac /inbac + +USER $USERNAME +CMD ["/inbac"] diff --git a/docker.sh b/docker.sh new file mode 100755 index 0000000..6a73db8 --- /dev/null +++ b/docker.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +xhost +si:localuser:"$USER" +xhost +local:docker +docker run -it --rm -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix -v "$HOME":/home $(docker build -q .) \ No newline at end of file