# # Docker image for wger development # # Please consult the documentation 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 ########## FROM ubuntu:20.04 as builder RUN apt-get update \ && apt-get install --no-install-recommends -y \ build-essential \ python3-dev \ python3-pip \ python3-wheel \ git \ && rm -rf /var/lib/apt/lists/* # Build the necessary python wheels COPY requirements* ./ RUN pip3 wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements_devel.txt ######## # Final ######## FROM wger/base:2.0-dev LABEL maintainer="Roland Geider " EXPOSE 8000 # Set locale to UTF8, otherwise problems with the encoding can occur, e.g. # when using the invoke/wger commands and bower RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 # Set up the application COPY --chown=wger:wger . /home/wger/src COPY --from=builder /usr/src/app/wheels /wheels WORKDIR /home/wger/src RUN pip3 install --no-cache /wheels/* \ && python3 setup.py develop \ && npm install \ && npm install bower USER wger WORKDIR /home/wger/src RUN wger create_settings \ --settings-path /home/wger/src/settings.py \ --database-path /home/wger/db/database.sqlite \ && wger bootstrap \ --settings-path /home/wger/src/settings.py \ --no-start-server # Download the exercise images RUN mkdir ~/media \ && sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings.py CMD ["/bin/bash"]