Self hosted FLOSS fitness/workout, nutrition and weight tracker
More tinkering with the dockerfile for development
Roland Geiderb815c2471691
diff --git a/extras/docker/development/Dockerfile b/extras/docker/development/Dockerfileindex ef449317b..a76129210 100644--- a/extras/docker/development/Dockerfile+++ b/extras/docker/development/Dockerfile@@ -1,23 +1,14 @@## Docker image for wger development#-# Please consult the documentation for usage+# Please consult the README for usage## Note: you MUST build this image from the projec's root!# docker build -f extras/docker/development/Dockerfile --tag wger/devel .## Run the container:# docker run -ti -v /path/to/this/checkout:/home/wger/src --name wger.devel --publish 8000:8000 wger/devel-#-# (in docker) python3 manage.py download-exercise-images (optional, may take some time)-# (in docker) python3 manage.py runserver 0.0.0.0:8000-#-# To stop the container:-# sudo docker container stop wger.devel-#-# To start developing again-# sudo docker container start --attach wger.devel-#+########### Builder@@ -47,8 +38,7 @@ LABEL maintainer="Roland Geider <[email protected]>"ARG DOCKER_DIR=./extras/docker/developmentEXPOSE 8000-# Set locale to UTF8, otherwise problems with the encoding can occur, e.g.-# when using the invoke/wger commands and bower+# Set locale to UTF8RUN locale-gen en_US.UTF-8ENV LANG en_US.UTF-8ENV LANGUAGE en_US:en@@ -63,18 +53,18 @@ WORKDIR /home/wger/srcCOPY --chown=wger:wger . /home/wger/srcCOPY --from=builder /wheels /wheelsCOPY ${DOCKER_DIR}/settings.py /home/wger/src+COPY ${DOCKER_DIR}/settings.py /tmp/COPY ${DOCKER_DIR}/entrypoint.sh /home/wger/entrypoint.shRUN chmod +x /home/wger/entrypoint.shRUN pip3 install --no-cache /wheels/* \&& pip3 install psycopg2-binary \&& pip3 install python-memcached \&& python3 setup.py develop \- && npm install \- && npm install bower-+ && npm installRUN chown -R wger:wger .+USER wger-RUN mkdir ~/media-RUN mkdir ~/db/+RUN mkdir ~/media \+ && mkdir ~/db/CMD ["/home/wger/entrypoint.sh"]diff --git a/extras/docker/development/README.md b/extras/docker/development/README.mdindex 712596a61..c94a7af19 100644--- a/extras/docker/development/README.md+++ b/extras/docker/development/README.md@@ -1,35 +1,46 @@-Development image for wger - Ubuntu based-=========================================+# Development image for wger - Ubuntu based+Thank you for downloading wger Workout Manager. wger (ˈvɛɡɐ) is a free, opensource web application that manages your exercises and personal workouts, weightand diet plans. It can also be used as a simple gym management utility, providingdifferent administrative roles (trainer, manager, etc.). It offers a REST APIas well, for easy integration with other projects and tools.-It is written with python/django and uses jQuery and some D3js for charts.-Installation-------------+## Usage++This docker image is meant to provide a quick development environment using+django's development server and an sqlite database from your current code+checkout (if you don't want or need a local checkout, use the wger/apache image,+it is self-contained)++### 1 - Start the container-This docker image contains an instance of the application running with django's-development server using a sqlite database. It can be used to quickly setup a-development instance::docker run -ti \-v /path/to/your/wger/checkout:/home/wger/src \--name wger.devel \- --publish 8000:8000 wger/devel \+ --publish 8000:8000 wger/devel++When developing with windows, you might have problems with the `--volume` option,+use the more verbose mount instead:++ --mount type=bind,source='"C:\your\path\to your\checkout"',target=/home/wger/src-On the first run you might want to download the exercise images (might take-some time):+### 2 - Download additional files-```python3 manage.py download-exercise-images```+On the first run, you need to download some CSS and JS files with bower (+as well as everytime there are updates):-To start the development server+ docker exec -ti wger.devel python3 manage.py bower install-```python3 manage.py runserver 0.0.0.0:8000```+You might also want to download the exercise images (will take some time):-Then just open <http://localhost:8000> and log in as: **admin**, password **admin**+ docker exec -ti wger.devel python3 manage.py download-exercise-images++### 3 - Open the Application++Just open <http://localhost:8000> and log in as: **admin**, password **admin**To stop the container:@@ -39,16 +50,16 @@ To start developing again:```sudo docker container start --attach wger.devel```-Building---------++## BuildingIf you build this yourself, keep in mind that you **must** build from theproject root!```docker build -f extras/docker/development/Dockerfile --tag wger/devel .```-Contact--------++## ContactFeel free to contact us if you found this useful or if there was something thatdidn't behave as you expected. We can't fix what we don't know about, so please@@ -60,15 +71,13 @@ file a bug anyway.* twitter: <https://twitter.com/wger_de>* mailing list: <https://groups.google.com/group/wger> / [email protected], no registration needed-Sources--------+## SourcesAll the code and the content is freely available:* Main repository: <https://github.com/wger-project/wger>-Licence--------+## LicenceThe application is licenced under the Affero GNU General Public License 3 orlater (AGPL 3+).diff --git a/extras/docker/development/entrypoint.sh b/extras/docker/development/entrypoint.shindex 92532ebc7..3be8c8bb8 100644--- a/extras/docker/development/entrypoint.sh+++ b/extras/docker/development/entrypoint.sh@@ -1,7 +1,11 @@#!/bin/bash-cd /home/wger/src+# Copy a settings file if not fould+if [ test ! -f /home/wger/src ]+ cp /tmp/settings.py /home/wger/src+fi+# If using docker compose, wait for postgresif [[ "$DJANGO_DB_PORT" == "5432" ]]; thenecho "Waiting for postgres..."@@ -12,12 +16,10 @@ if [[ "$DJANGO_DB_PORT" == "5432" ]]; thenecho "PostgreSQL started :)"fi-if [[ "$WGER_BOOTSTRAP" == "TRUE" ]];-then- wger bootstrap \- --settings-path /home/wger/src/settings.py \- --no-start-server-fi+# Bootstrap the application+wger bootstrap \+ --settings-path /home/wger/src/settings.py \+ --no-start-serverif [[ "$WGER_DOWNLOAD_IMGS" == "TRUE" ]];then@@ -25,5 +27,5 @@ thenchmod -R g+w ~wger/mediafi-#exec "$@"+# Run the development serverpython3 manage.py runserver 0.0.0.0:8000diff --git a/extras/docker/docker-compose/dev.env b/extras/docker/docker-compose/dev.envindex 8b1292a9b..be833a91f 100644--- a/extras/docker/docker-compose/dev.env+++ b/extras/docker/docker-compose/dev.env@@ -14,5 +14,3 @@ DJANGO_CACHE_PORT=11211DJANGO_CACHE_TIMEOUT=100DJANGO_MEDIA_ROOT=/home/wger/media--WGER_BOOTSTRAP=TRUEdiff --git a/extras/docker/docker-compose/docker-compose.yml b/extras/docker/docker-compose/docker-compose.ymlindex 744bdb56f..2f9586ebb 100644--- a/extras/docker/docker-compose/docker-compose.yml+++ b/extras/docker/docker-compose/docker-compose.yml@@ -22,7 +22,7 @@ services:image: postgres:12.0-alpinevolumes:- type: bind- source: ./wger-postgres-data+ source: /tmp/wger-postgres-datatarget: /var/lib/postgresql/data/environment:- POSTGRES_USER=wgerdiff --git a/extras/docker/docker-compose/env b/extras/docker/docker-compose/envdeleted file mode 100644index c00f63fc0..000000000--- a/extras/docker/docker-compose/env+++ /dev/null@@ -1,5 +0,0 @@-DB_NAME=myproject_web-DB_USER=myproject_web-DB_PASS=shoov3Phezaimahsh7eb2Tii4ohkah8k-DB_SERVICE=postgres-DB_PORT=5432diff --git a/wger/tasks.py b/wger/tasks.pyindex d38bcff3e..4f63b4f4a 100644--- a/wger/tasks.py+++ b/wger/tasks.py@@ -119,8 +119,7 @@ def bootstrap(context,create_or_reset_admin(context, settings_path=settings_path)# Download JS libraries with bower- context.run('npm install bower')- context.run('npm install')+ call_command("bower", "install")# Start the webserverif start_server: