-
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
0 parents
commit 970441b
Showing
332 changed files
with
62,367 additions
and
0 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 @@ | ||
docs/ |
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,159 @@ | ||
# temp directory for testing | ||
http_config.ini | ||
tests/temp/* | ||
tests/logs/* | ||
examples/logging/logs/* | ||
*examples/logging/logs/* | ||
examples/color_print/logs/* | ||
default_app.py | ||
|
||
.vscode/launch.json | ||
### Python template | ||
|
||
# config file | ||
*.sock | ||
conf/* | ||
config/* | ||
data/* | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
*logs/* | ||
|
||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
Empty file.
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 @@ | ||
3.9.13 |
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,14 @@ | ||
|
||
--build-arg BASE_IMAGE=python:3.9.13-slim-buster | ||
--build-arg BUILD_DATE=2023-11-07T05:29:04UTC | ||
--build-arg DOCKER_BUILD_OPTION=--no-cache --rm=true | ||
--build-arg ECHO_OPTION= | ||
--build-arg GIT_USER=JINWOO-J | ||
--build-arg IS_MULTI_ARCH=false | ||
--build-arg LOCAL_SERVER=20.20.5.172 | ||
--build-arg NAME=pawnlib | ||
--build-arg PRIMARY_BRANCH=master | ||
--build-arg REPO_HUB=jinwoo | ||
--build-arg SED_OPTION='' | ||
--build-arg UNAME_S=Darwin | ||
--build-arg VERSION=1.0.32 |
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 @@ | ||
docs.jinwoo.xyz |
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,14 @@ | ||
|
||
-e BASE_IMAGE=python:3.9.13-slim-buster | ||
-e BUILD_DATE=2023-11-07T02:00:57UTC | ||
-e DOCKER_BUILD_OPTION=--no-cache --rm=true | ||
-e ECHO_OPTION="" | ||
-e GIT_USER=JINWOO-J | ||
-e IS_MULTI_ARCH=false | ||
-e LOCAL_SERVER=20.20.5.172 | ||
-e NAME=pawnlib | ||
-e PRIMARY_BRANCH=master | ||
-e REPO_HUB=jinwoo | ||
-e SED_OPTION= | ||
-e UNAME_S=Darwin | ||
-e VERSION=latest |
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,41 @@ | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} | ||
ARG VERSION | ||
ARG NAME | ||
ARG REMOVE_BUILD_PACKAGE | ||
|
||
LABEL maintainer="infra team" \ | ||
org.label-schema.build-date="${BUILD_DATE}" \ | ||
org.label-schema.name="pawnlib-docker" \ | ||
org.label-schema.description="Docker images for operating Infra." \ | ||
org.label-schema.url="https://www.iconloop.com/" \ | ||
org.label-schema.vcs-ref="${VCS_REF}" \ | ||
org.label-schema.vcs-url="https://github.com/jinwoo-j/pawnlib" \ | ||
org.label-schema.vendor="ICONLOOP Inc." \ | ||
org.label-schema.version="${VERSION}-${VCS_REF}" | ||
|
||
ENV IS_DOCKER=true \ | ||
NAME=${NAME} \ | ||
VERSION=${VERSION} \ | ||
REMOVE_BUILD_PACKAGE=${REMOVE_BUILD_PACKAGE:-"true"} \ | ||
LIB_PACKAGE="libcurl4-openssl-dev jq telnet" \ | ||
BUILD_PACKAGE="" | ||
# PYCURL_SSL_LIBRARY=openssl \ | ||
|
||
COPY . /pawnlib/ | ||
WORKDIR /pawnlib | ||
|
||
RUN ARCH="$(dpkg --print-architecture)" ; \ | ||
apt update && apt install -y ${BUILD_PACKAGE} ${LIB_PACKAGE} && \ | ||
if [ "${ARCH}" = 'aarch64' ]; then apt install -y gcc make pkg-config; fi && \ | ||
if [ "${ARCH}" = 'arm64' ]; then apt install -y gcc make pkg-config; fi && \ | ||
python3 setup.py bdist_wheel && \ | ||
pip3 install dist/pawnlib-*.whl --force-reinstall && \ | ||
pip3 install -r requirements-full.txt && \ | ||
if [ "$REMOVE_BUILD_PACKAGE" = "true" ]; then \ | ||
echo "REMOVE_BUILD_PACKAGE" ; \ | ||
apt-get purge -y --auto-remove ${BUILD_PACKAGE} && \ | ||
rm -rf /var/lib/apt/lists/* ; \ | ||
fi; | ||
|
||
RUN echo 'export PS1=" \[\e[00;32m\]${NAME}: ${VERSION}\[\e[0m\]\[\e[00;37m\]@\[\e[0m\]\[\e[00;31m\]\H:\\$\[\e[0m\] "' >> /root/.bashrc |
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 @@ | ||
recursive-include pawnlib/builder/templates * |
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,145 @@ | ||
NAME = pawnlib | ||
GIT_USER = JINWOO-J | ||
PRIMARY_BRANCH = master | ||
BUILD_DATE = $(strip $(shell date -u +"%Y-%m-%dT%H:%M:%S%Z")) | ||
BASE_IMAGE = python:3.9.13-slim-buster | ||
REPO_HUB = jinwoo | ||
IS_MULTI_ARCH = false | ||
TERM=xterm | ||
|
||
ifeq ($(IS_MULTI_ARCH), true) | ||
DOCKER_BUILD_CMD = buildx build --platform linux/arm64,linux/amd64 --push | ||
else | ||
DOCKER_BUILD_CMD = build | ||
endif | ||
|
||
define colorecho | ||
@tput setaf 6 | ||
@echo $1 | ||
@tput sgr0 | ||
endef | ||
|
||
UNAME_S := $(shell uname -s) | ||
ifeq ($(UNAME_S),Linux) | ||
ECHO_OPTION = "-e" | ||
SED_OPTION = | ||
endif | ||
ifeq ($(UNAME_S),Darwin) | ||
ECHO_OPTION = "" | ||
SED_OPTION = '' | ||
endif | ||
|
||
NO_COLOR=\033[0m | ||
OK_COLOR=\033[32m | ||
ERROR_COLOR=\033[31m | ||
WARN_COLOR=\033[93m | ||
|
||
TEST_FILES := $(shell find tests -name '*.yml') | ||
LOCAL_SERVER := 20.20.5.172 | ||
VERSION := $(shell python3 -c "from pawnlib import __version__;print(__version__.__version__)") | ||
|
||
#TAGNAME = VERSION | ||
|
||
#git_describe_ver = $(shell git describe --tags | sed -E -e 's/^v//' -e 's/(.*)-.*/\1/') | ||
|
||
ifeq ($(IS_LOCAL), true) | ||
DOCKER_BUILD_OPTION = --progress=plain --no-cache --rm=true | ||
else | ||
DOCKER_BUILD_OPTION = --no-cache --rm=true | ||
endif | ||
|
||
.PHONY: all build push test tag_latest release ssh bash | ||
|
||
all: build upload | ||
version: | ||
@echo $(VERSION) | ||
|
||
print_version: | ||
# @echo "$(OK_COLOR) VERSION-> $(VERSION) REPO-> $(REPO_HUB)/$(NAME):$(VERSION) $(NO_COLOR) IS_LOCAL: $(IS_LOCAL)" | ||
@echo "VERSION-> $(VERSION) REPO-> $(REPO_HUB)/$(NAME):$(VERSION) IS_LOCAL: $(IS_LOCAL)" | ||
|
||
make_debug_mode: | ||
@$(shell echo $(ECHO_OPTION) "$(OK_COLOR) ----- DEBUG Environment ----- $(MAKECMDGOALS) \n $(NO_COLOR)" >&2)\ | ||
$(shell echo "" > DEBUG_ARGS) \ | ||
$(foreach V, \ | ||
$(sort $(.VARIABLES)), \ | ||
$(if \ | ||
$(filter-out environment% default automatic, $(origin $V) ), \ | ||
$($V=$($V)) \ | ||
$(if $(filter-out "SHELL" "%_COLOR" "%_STRING" "MAKE%" "colorecho" ".DEFAULT_GOAL" "CURDIR" "TEST_FILES" "DOCKER_BUILD_CMD" "TERM", "$V" ), \ | ||
$(shell echo $(ECHO_OPTION) '$(OK_COLOR) $V = $(WARN_COLOR) $($V) $(NO_COLOR) ' >&2;) \ | ||
$(shell echo '-e $V=$($V) ' >> DEBUG_ARGS)\ | ||
)\ | ||
)\ | ||
) | ||
|
||
make_build_args: | ||
@$(shell echo $(ECHO_OPTION) "$(OK_COLOR) ----- Build Environment ----- \n $(NO_COLOR)" >&2)\ | ||
$(shell echo "" > BUILD_ARGS) \ | ||
$(foreach V, \ | ||
$(sort $(.VARIABLES)), \ | ||
$(if \ | ||
$(filter-out environment% default automatic, $(origin $V) ), \ | ||
$($V=$($V)) \ | ||
$(if $(filter-out "SHELL" "%_COLOR" "%_STRING" "MAKE%" "colorecho" ".DEFAULT_GOAL" "CURDIR" "TEST_FILES" "DOCKER_BUILD_CMD" "TERM", "$V" ), \ | ||
$(shell echo $(ECHO_OPTION) '$(OK_COLOR) $V = $(WARN_COLOR) $($V) $(NO_COLOR) ' >&2;) \ | ||
$(shell echo "--build-arg $V=$($V) " >> BUILD_ARGS)\ | ||
)\ | ||
)\ | ||
) | ||
|
||
test: make_build_args print_version | ||
python3 -m unittest tests/test_*.py | ||
|
||
clean: | ||
rm -rf build dist *.egg-info | ||
|
||
|
||
build: make_build_args clean test | ||
#python3 setup.py bdist_wheel | ||
hatchling build | ||
|
||
|
||
init: | ||
git init | ||
git add . | ||
git commit -m "first commit" | ||
git branch -M $(PRIMARY_BRANCH) | ||
git remote add origin git@github.com:$(GIT_USER)/$(NAME).git | ||
git push -u origin $(PRIMARY_BRANCH) | ||
|
||
|
||
upload: | ||
python3 -m twine upload dist/* --verbose | ||
|
||
gendocs: | ||
@$(shell ./makeMakeDown.sh) | ||
|
||
|
||
docker: make_build_args | ||
docker $(DOCKER_BUILD_CMD) $(DOCKER_BUILD_OPTION) -f Dockerfile \ | ||
$(shell cat BUILD_ARGS) -t $(REPO_HUB)/$(NAME):$(VERSION) . | ||
$(call colorecho, "\n\nSuccessfully build '$(REPO_HUB)/$(NAME):$(VERSION)'") | ||
# @echo "===========================================================================" | ||
# @docker images | grep $(REPO_HUB)/$(NAME) | grep $(VERSION) || true | ||
|
||
push_hub: print_version | ||
docker tag $(REPO_HUB)/$(NAME):$(VERSION) $(REPO_HUB)/$(NAME):latest | ||
docker push $(REPO_HUB)/$(NAME):$(VERSION) | ||
docker push $(REPO_HUB)/$(NAME):latest | ||
|
||
bash: make_debug_mode print_version | ||
docker run $(shell cat DEBUG_ARGS) -it -v $(PWD):/pawnlib \ | ||
-e VERSION=$(VERSION) -v $(PWD)/src:/src --entrypoint /bin/bash \ | ||
--name $(NAME) --cap-add SYS_TIME --rm $(REPO_HUB)/$(NAME):$(VERSION) | ||
|
||
bb: | ||
docker run -it --rm $(REPO_HUB)/$(NAME):$(VERSION) bash | ||
|
||
local: build | ||
pip3 install dist/pawnlib-$(VERSION)-py3-none-any.whl --force-reinstall | ||
|
||
local_deploy: build | ||
scp dist/pawnlib-$(VERSION)-py3-none-any.whl root@$(LOCAL_SERVER):/app/; | ||
ssh root@$(LOCAL_SERVER) pip3 install /app/pawnlib-$(VERSION)-py3-none-any.whl --force-reinstall | ||
|
Oops, something went wrong.