diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..958f4156 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:2.7 +RUN apt-get update \ + && apt-get install -y postgresql postgresql-contrib build-essential libmemcached-dev zlib1g-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN mkdir /swapi +WORKDIR /swapi +COPY . /swapi + +#RUN apk add --update alpine-sdk +#RUN apk add --no-cache postgresql-libs postgresql-dev + +RUN make install \ + && make build \ + && make load_data + +CMD [ "make", "serve"] \ No newline at end of file diff --git a/Makefile b/Makefile index 3485be1d..656e25bb 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ load_data: python manage.py loaddata films.json serve: - python manage.py runserver + python manage.py runserver 0.0.0.0:8080 dump_data: python manage.py dumpdata resources.planet > resources/fixtures/planets.json --indent 4 diff --git a/README.md b/README.md index afa545a7..4a0d8c05 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,18 @@ Source code for [swapi.co](https://swapi.co) +## Docker + +To run Swapi on your Docker installation see the included Dockerfile. It is also available at Docker Hub + + +``` +docker run -d -p 8080:8080 svenwal/swapi +curl http://localhost:8080/api/people/1/ +``` + [![Circle CI](https://circleci.com/gh/phalt/swapi.svg?style=svg)](https://circleci.com/gh/phalt/swapi) +## Contributing + For contributing, please see CONTRIBUTING.md