-
Notifications
You must be signed in to change notification settings - Fork 48
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
4647b68
commit 8bf7f2e
Showing
4 changed files
with
103 additions
and
8 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Example ~/.env.wtfis file | ||
# Don't forget to chmod 400! | ||
VT_API_KEY = foo | ||
PT_API_KEY = bar | ||
PT_API_USER = [email protected] | ||
IP2WHOIS_API_KEY = alice | ||
SHODAN_API_KEY = hunter2 | ||
# WTFIS_DEFAULTS = "-s -1 -n" | ||
VT_API_KEY=foo | ||
PT_API_KEY=bar | ||
PT_API_USER=[email protected] | ||
IP2WHOIS_API_KEY=alice | ||
SHODAN_API_KEY=hunter2 | ||
# WTFIS_DEFAULTS=-s -1 -n |
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,51 @@ | ||
#################################### | ||
# Builder image | ||
#################################### | ||
|
||
FROM python:3.10-slim as builder | ||
|
||
WORKDIR /workspace | ||
COPY . . | ||
|
||
# Install git | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends git | ||
|
||
# Checkout latest tagged commit | ||
RUN git checkout \ | ||
tags/$(git describe --tags $(git rev-list --tags --max-count=1)) \ | ||
-b latest_tag | ||
|
||
# Ensure latest pip | ||
RUN python -m pip install --upgrade pip | ||
|
||
# Install hatch | ||
RUN pip install hatch | ||
|
||
# Clean build wheel and src tarball | ||
RUN hatch build --clean | ||
|
||
|
||
#################################### | ||
# Final image | ||
#################################### | ||
|
||
FROM python:3.10-slim | ||
|
||
# Create user and cd to work dir | ||
RUN useradd --create-home --shell /bin/bash wtfis | ||
WORKDIR /home/wtfis | ||
|
||
# Copy wheel file from builder image | ||
COPY --from=builder /workspace/dist/*.whl . | ||
|
||
# Upgrade pip, install wheel and delete wheel file | ||
RUN python -m pip install --upgrade pip && \ | ||
pip install *.whl && \ | ||
rm -f *.whl | ||
|
||
# Run as user | ||
USER wtfis | ||
|
||
# Command | ||
CMD ["bash"] |
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,12 @@ | ||
PROJECT_NAME := wtfis | ||
WTFIS_ENV_FILE := ${HOME}/.env.wtfis | ||
|
||
# Build Docker image of the latest tagged commit | ||
.PHONY: docker-image | ||
docker-image: | ||
docker build -t $(PROJECT_NAME) --rm . | ||
|
||
# Run and exec into the Docker image | ||
.PHONY: docker-run | ||
docker-run: | ||
docker run --env-file=$(WTFIS_ENV_FILE) -it wtfis |
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