-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
97 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
Dockerfile | ||
LICENSE | ||
README.md | ||
.gitignore | ||
.vscode/ | ||
.github/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 .) |