diff --git a/.gitignore b/.gitignore index 7cc2b7e..3a5d1f1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ dist/ *.idea/ venv/ venv-numismatic/ +.editorconfig diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a1abd75 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.6-alpine +WORKDIR /usr/src/app +COPY ./ /usr/src/app +RUN pip install -e . +WORKDIR numismatic +CMD coin diff --git a/devops/coin-cli/README.md b/devops/coin-cli/README.md deleted file mode 100644 index 294d0db..0000000 --- a/devops/coin-cli/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Numismatic coin-cli docker environment -Build and run a numismatic coin-cli from an already configured environment - -**Dependencies:** - - Packer - ``` - curl -O https://releases.hashicorp.com/packer/1.1.0/packer_1.1.0_linux_amd64.zip - unzip packer_1.1.0_linux_amd64.zip -d /usr/local/bin - ``` - - Docker (see https://docs.docker.com/engine/installation/) - -**Build:** - - `cd ./devops/coin-cli/packer/builders/docker` - - `. ./coin-cli.build` - -**Run:** - - `cd ./devops/coin-cli/packer/builders/docker` - - `. ./coin-cli.run` - - Each of the following commands, when executed in the same shell as the - command above, mounts the current working directory into a Docker container - and runs the following process: - - `dcoin`: numismatic coin-cli with the numismatic environment configured - - `coinbash`: A Bash shell with the numismatic environment configured - - `coinpy`: A Python shell with the numismatic environment configured - -**Tips:** - - In order to have the commands in the section above persistently available: - - `cat ./coin-cli.run >> ~/.bash_aliases` - - or `cp ./coin-cli.run ~/.oh-my-zsh/custom/coin-cli.zsh` - (if you use oh-my-zsh) diff --git a/devops/coin-cli/packer/builders/docker/coin-cli.build b/devops/coin-cli/packer/builders/docker/coin-cli.build deleted file mode 100644 index bad7be2..0000000 --- a/devops/coin-cli/packer/builders/docker/coin-cli.build +++ /dev/null @@ -1 +0,0 @@ -packer build template.json diff --git a/devops/coin-cli/packer/builders/docker/coin-cli.run b/devops/coin-cli/packer/builders/docker/coin-cli.run deleted file mode 100644 index 21b99b8..0000000 --- a/devops/coin-cli/packer/builders/docker/coin-cli.run +++ /dev/null @@ -1,9 +0,0 @@ -dcoin() { - docker run --net=host -v $PWD:/tmp/working -w=/tmp/working --rm -it numismatic/coin:latest /home/user/numismatic/venv/bin/coin $@ -} -coinbash() { - docker run --net=host -v $PWD:/tmp/working -w=/tmp/working --rm -it numismatic/coin:latest /bin/bash -} -coinpy() { - docker run --net=host -v $PWD:/tmp/working -w=/tmp/working --rm -it numismatic/coin:latest /home/user/numismatic/venv/bin/python -} \ No newline at end of file diff --git a/devops/coin-cli/packer/builders/docker/provisioners/shell/build.sh b/devops/coin-cli/packer/builders/docker/provisioners/shell/build.sh deleted file mode 100644 index 8877db1..0000000 --- a/devops/coin-cli/packer/builders/docker/provisioners/shell/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/ash -ex -cd /home/user -git clone https://github.com/snth/numismatic.git -cd ./numismatic -python3.6 -m venv venv -source ./venv/bin/activate -pip install -U pip -pip install wheel -pip install -e . -chown user:user -R /home/user diff --git a/devops/coin-cli/packer/builders/docker/provisioners/shell/dependencies.sh b/devops/coin-cli/packer/builders/docker/provisioners/shell/dependencies.sh deleted file mode 100644 index 0093b56..0000000 --- a/devops/coin-cli/packer/builders/docker/provisioners/shell/dependencies.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/ash -ex -apk update; apk upgrade; apk add \ - bash \ - bash-completion \ - git \ - python3-dev -addgroup user -adduser -S user diff --git a/devops/coin-cli/packer/builders/docker/template.json b/devops/coin-cli/packer/builders/docker/template.json deleted file mode 100644 index beb69f4..0000000 --- a/devops/coin-cli/packer/builders/docker/template.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "builders": [ - { - "type": "docker", - "image": "alpine", - "commit": "true", - "changes": [ - "USER user" - ], - "run_command": [ - "--net=host", - "-d", - "-i", - "-t", - "{{.Image}}", - "/bin/ash" - ] - } - ], - "provisioners": [ - { - "type": "shell", - "script": "{{template_dir}}/provisioners/shell/dependencies.sh" - }, - { - "type": "shell", - "script": "{{template_dir}}/provisioners/shell/build.sh" - } - ], - "post-processors": [ - [ - { - "type": "docker-tag", - "repository": "numismatic/coin", - "tag": "latest" - } - ] - ] -} \ No newline at end of file