diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..5e2dfce80 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +.tox diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..27092cf91 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Docker image for poliastro development +FROM python:3.7 +LABEL maintainer="Juan Luis Cano Rodríguez " + +# https://pythonspeed.com/articles/activate-virtualenv-dockerfile/ +ENV VIRTUAL_ENV=/opt/venv +RUN python -m venv ${VIRTUAL_ENV} +ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" + +RUN python -m pip install -U pip setuptools +RUN python -m pip install flit pygments wheel + +WORKDIR /code + +# Unfortunately this will invalidate the cache +# for every code change +# Wouldn't it be nice to have a flit compile +# that freezes a requirements.txt? +COPY . /code + +ENV FLIT_ROOT_INSTALL=1 +RUN flit install --symlink --extras dev diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..e65508160 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +DOCKER_BASE_IMAGE := "poliastro:dev" +DOCKER_CONTAINER_NAME := "poliastro-dev" + + +image: Dockerfile pyproject.toml + docker build \ + -t poliastro:dev \ + . + +docker: + docker run \ + -it \ + --rm \ + --name ${DOCKER_CONTAINER_NAME} \ + --volume $(shell pwd):/code \ + --user $(shell id -u):$(shell id -g) \ + ${DOCKER_BASE_IMAGE} \ + bash + +.PHONY: docker image