Skip to content

Commit 2e0c215

Browse files
committed
Refactor Repo to use Docker, Make, and Poetry
1 parent db5ba8a commit 2e0c215

File tree

9 files changed

+65
-22
lines changed

9 files changed

+65
-22
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM python:3.8-slim as base
2+
3+
WORKDIR /data
4+
5+
# Install Deps if there are any
6+
COPY pyproject.toml poetry.lock ./
7+
RUN pip3 install poetry && \
8+
poetry install --only main --no-root
9+
10+
COPY . .

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
IMAGE_NAME?=mtconnect-python
3+
build:
4+
docker build --tag ${IMAGE_NAME} .
5+
6+
develop: build
7+
./scripts/run_develop_container.sh ${IMAGE_NAME} bash
8+
9+
test: build
10+
./scripts/run_develop_container.sh ${IMAGE_NAME} python3 -m unittest
11+
12+
PYPI_USER?=${PYPI_USER}
13+
PYPI_PASSWORD?=${PYPI_PASSWORD}
14+
publish: build
15+
./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/publish_package.sh

poetry.lock

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tool.poetry]
2+
name = "MTConnect"
3+
version = "0.3.3"
4+
description = "A python agent for MTConnect"
5+
authors = ["Michael Honaker <[email protected]>"]
6+
license = "\"Apache License 2.0\""
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.8"
10+
11+
[tool.poetry.dev-dependencies]
12+
13+
[build-system]
14+
requires = ["poetry-core>=1.0.0"]
15+
build-backend = "poetry.core.masonry.api"

scripts/publish_package.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
poetry build
4+
poetry publish --username "${PYPI_USER}" --password "${PYPI_PASSWORD}"

scripts/run_develop_container.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
if [ "$#" -lt 2 ]; then
4+
echo "Please supply image name and command to run"
5+
exit 1
6+
fi
7+
8+
image_name=$1
9+
10+
docker run -it --name develop-ctr \
11+
-e PYPI_USER="${PYPI_USER}" \
12+
-e PYPI_PASSWORD="${PYPI_PASSWORD}" \
13+
--rm ${image_name} "${@:2}"

setup.py

Lines changed: 0 additions & 22 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)