diff --git a/.dockerignore b/.dockerignore index e8a422e..8500e31 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,5 @@ -testenv \ No newline at end of file +/testenv/ +build/* +dist/* +*.egg-info/* +__pycache__ diff --git a/Dockerfile b/Dockerfile index 21066b0..08fcc15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,18 @@ FROM ubuntu:focal RUN apt-get update && \ - apt-get install -y python3-pip + DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip && \ + rm -rf /var/lib/apt/lists/* ADD requirements.txt /tmp/requirements.txt RUN pip3 install -r /tmp/requirements.txt -ADD scrape.py /usr/local/bin/scrape.py +ADD . /tmp/code/ -RUN chmod +x /usr/local/bin/scrape.py +RUN cd /tmp/code && \ + python3 setup.py install -ENTRYPOINT ["/usr/local/bin/scrape.py"] +USER nobody + +ENTRYPOINT ["osrsscrape"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..604b985 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +DOCKERIMAGE := dockermirror:5000/dpedu/rsscrape +DOCKEROPTS := +BINARY := dist/osrsscrape-0.0.0-py3-none-any.whl + +.PHONY: $(BINARY) +$(BINARY): + python3 setup.py bdist_wheel + +.PHONY: image +image: + docker build -t $(DOCKERIMAGE) $(DOCKEROPTS) . + +.PHONY: push +push: image + docker push $(DOCKERIMAGE) + +.PHONY: testenv +testenv: + virtualenv -p python3 testenv + testenv/bin/pip3 install -r requirements.txt