SigmaHQ / sigma-cli

The Sigma command line interface based on pySigma
132 stars 34 forks source link

Add Dependabot.yml and Docker Container Build and release workflow #7

Open 8ear opened 2 years ago

8ear commented 2 years ago

Hi, I like your python tool very much. But I not so a big fan of installing python stuff all the time directly on my machine. Therefore I created a Dockerfile to create a docker container from your content and include directly a Github workflow so that the container is build automatically to the github repository.

Please check out the stuff.

Kind regards Max

thomaspatzke commented 1 year ago

Cool 👍 Thanks a lot for the contribution!

I see some further setup in the repo is required, I will do this when I find some time.

sifex commented 1 year ago

@8ear would probably be better to build from source and use multi-stage to keep the file size down as much as possible

Here's one I was gonna submit but found your PR ☺️

FROM python:3-slim as poetry

ENV POETRY_HOME=/opt/poetry
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV PATH="$POETRY_HOME/bin:$PATH"
WORKDIR /app

# Install Poetry
RUN python -c 'from urllib.request import urlopen; print(urlopen("https://install.python-poetry.org").read().decode())' | python -

# Copy pyproject.toml
COPY pyproject.toml pyproject.toml
COPY poetry.lock poetry.lock

# Install packages
RUN pip3 install --upgrade pip
RUN poetry install --only main --no-interaction --no-ansi --no-root -vvv

# Install sigma-cli
COPY ./ ./
RUN rm -r .github/ .git/
RUN poetry install --only main --no-interaction --no-ansi -vvv

# Copy Artifacts to clean image
FROM python:3.11-alpine as runtime

WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH "${PYTHONPATH}:/app:/app/.venv/lib/python3.11/site-packages/"

# Copy sigma-cli over
COPY --from=poetry /app /app

ENTRYPOINT ["sigma"]
CMD ["--help"]