forked from Der-Henning/tgtg
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
c6c8c2d
commit e1fde61
Showing
5 changed files
with
279 additions
and
45 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
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
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,45 +1,36 @@ | ||
FROM python:3-slim as base | ||
FROM python:3.10-slim | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_NO_INTERACTION=1 \ | ||
CARGO_NET_GIT_FETCH_WITH_CLI=true \ | ||
PYSETUP_PATH="/opt/pysetup" \ | ||
VENV_PATH="/opt/pysetup/.venv" | ||
PIP_NO_WARN_SCRIPT_LOCATION=0 | ||
ENV TGTG_TOKEN_PATH=/tokens | ||
ENV LOGS_PATH=/logs | ||
ENV DOCKER=true | ||
ENV POETRY_VERSION=1.5.1 | ||
ENV UID=1000 | ||
ENV GID=1000 | ||
|
||
RUN addgroup --gid $GID tgtg && \ | ||
adduser --shell /bin/false --disabled-password --uid $UID --gid $GID tgtg | ||
adduser --shell /bin/false \ | ||
--disabled-password \ | ||
--uid $UID \ | ||
--gid $GID \ | ||
tgtg | ||
RUN mkdir -p /logs | ||
RUN mkdir -p /tokens | ||
RUN chown tgtg:tgtg /tokens | ||
RUN chown tgtg:tgtg /logs | ||
VOLUME /tokens | ||
RUN apt-get update && apt-get upgrade -y | ||
WORKDIR $PYSETUP_PATH | ||
COPY . . | ||
|
||
# Build dependencies | ||
FROM base as builder | ||
RUN apt-get install -y build-essential libssl-dev libffi-dev python3-dev cargo pkg-config | ||
RUN pip install --upgrade pip setuptools wheel && \ | ||
pip install "poetry==$POETRY_VERSION" | ||
RUN poetry install --without test,build | ||
RUN --mount=type=bind,target=/context \ | ||
pip install -r /context/docker/requirements.txt && \ | ||
pip install /context | ||
|
||
# Create Production Image | ||
FROM base as production | ||
ENV PATH="$VENV_PATH/bin:$PATH" | ||
COPY ./docker/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
COPY --from=builder $VENV_PATH $VENV_PATH | ||
|
||
RUN python -m tgtg_scanner -v | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD [ "python", "-m", "tgtg_scanner" ] |
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,46 +1,38 @@ | ||
FROM python:3-alpine as base | ||
FROM python:3.10-alpine as base | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_NO_INTERACTION=1 \ | ||
CARGO_NET_GIT_FETCH_WITH_CLI=true \ | ||
PYSETUP_PATH="/opt/pysetup" \ | ||
VENV_PATH="/opt/pysetup/.venv" | ||
PIP_NO_WARN_SCRIPT_LOCATION=0 | ||
ENV TGTG_TOKEN_PATH=/tokens | ||
ENV LOGS_PATH=/logs | ||
ENV DOCKER=true | ||
ENV POETRY_VERSION=1.5.1 | ||
ENV UID=1000 | ||
ENV GID=1000 | ||
|
||
RUN addgroup --gid $GID --system tgtg && \ | ||
adduser --shell /bin/false --disabled-password --uid $UID --system --ingroup tgtg tgtg | ||
adduser --shell /bin/false \ | ||
--disabled-password \ | ||
--uid $UID \ | ||
--system \ | ||
--ingroup tgtg \ | ||
tgtg | ||
RUN mkdir -p /logs | ||
RUN mkdir -p /tokens | ||
RUN chown tgtg:tgtg /tokens | ||
RUN chown tgtg:tgtg /logs | ||
VOLUME /tokens | ||
RUN apk update | ||
WORKDIR $PYSETUP_PATH | ||
COPY . . | ||
|
||
# Build dependencies | ||
FROM base as builder | ||
RUN apk add --no-cache alpine-sdk libffi-dev gcc musl-dev python3-dev openssl-dev cargo pkgconfig | ||
RUN pip install --upgrade pip setuptools wheel && \ | ||
pip install "poetry==$POETRY_VERSION" | ||
RUN poetry install --without test,build | ||
RUN apk update && apk add --no-cache shadow runuser | ||
RUN --mount=type=bind,target=/context \ | ||
pip install -r /context/docker/requirements.txt && \ | ||
pip install /context | ||
|
||
# Create Production Image | ||
FROM base as production | ||
ENV PATH="$VENV_PATH/bin:$PATH" | ||
RUN apk add --no-cache shadow runuser | ||
COPY ./docker/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
COPY --from=builder $VENV_PATH $VENV_PATH | ||
|
||
RUN python -m tgtg_scanner -v | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD [ "python", "-m", "tgtg_scanner" ] |
Oops, something went wrong.