Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
Add Dockerfile for development
Browse files Browse the repository at this point in the history
  • Loading branch information
astrojuanlu committed Dec 2, 2019
1 parent 275dece commit 0a63d95
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
.tox
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Docker image for poliastro development
FROM python:3.7
LABEL maintainer="Juan Luis Cano Rodríguez <hello@juanlu.space>"

# 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
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0a63d95

Please sign in to comment.