Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Repair the dockerfiles

Roland60132737047e
diff --git a/README.rst b/README.rst
index 2eab29186..e639a088a 100644
--- a/README.rst
+++ b/README.rst
@@ -165,7 +165,6 @@ Sources
All the code and the content is freely available:
* **Main repository:** https://github.com/wger-project/wger
-* **Mirror:** https://bitbucket.org/rolandgeider/wger
Donations
diff --git a/extras/docker/apache/Dockerfile b/extras/docker/apache/Dockerfile
index 442ed02d0..82866a0fd 100644
--- a/extras/docker/apache/Dockerfile
+++ b/extras/docker/apache/Dockerfile
@@ -1,13 +1,21 @@
#
# A wger installation under apache with WSGI
#
+# Note: you MUST build this image from the projec's root!
+# docker build -f extras/docker/apache/Dockerfile --tag wger/apache .
+#
# Please consult the documentation for usage
# docker build --tag wger/apache .
# docker run -ti --name wger.apache --publish 8000:80 wger/apache
#
+# To stop the container:
+# sudo docker container stop wger.apache
+#
+# To start developing again
+# sudo docker container start --attach wger.apache
#
-FROM wger/base
+FROM wger/base:1.9
LABEL maintainer="Roland Geider <[email protected]>"
EXPOSE 80
@@ -56,12 +64,15 @@ RUN ln -s /home/wger/static/CACHE /var/www
USER wger
WORKDIR /home/wger/src
-RUN virtualenv --python python3 /home/wger/venv
+RUN python3 -m venv /home/wger/venv
RUN . /home/wger/venv/bin/activate \
&& pip install --upgrade pip \
+ && pip install wheel \
&& pip install -r requirements.txt \
&& pip install -r requirements_forked.txt \
&& python setup.py develop \
+ && npm install \
+ && npm install bower \
&& wger create_settings \
--settings-path /home/wger/src/settings.py \
--database-path /home/wger/db/database.sqlite \
@@ -72,17 +83,15 @@ RUN . /home/wger/venv/bin/activate \
# Change permissions of some files and folders so the apache process
# can access them.
-RUN chmod o+w -R ~/db/ \
- && . /home/wger/venv/bin/activate \
- && mkdir -p ~/static/CACHE ~/media \
+RUN mkdir -p ~/static/CACHE ~/media \
&& ln -s /home/wger/static/CACHE /home/wger/src/CACHE \
&& chmod g+w /home/wger/static/CACHE \
&& sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings.py \
&& echo STATIC_ROOT=\'/home/wger/static\' >> settings.py
USER root
-
RUN apt-get remove build-essential -y \
- && apt autoremove -y
+ && apt autoremove -y \
+ && chown www-data:www-data -R /home/wger/db
ENTRYPOINT ["/home/wger/entrypoint.sh"]
diff --git a/extras/docker/apache/README.md b/extras/docker/apache/README.md
index 43bb8c46c..caa20bf6a 100644
--- a/extras/docker/apache/README.md
+++ b/extras/docker/apache/README.md
@@ -20,6 +20,24 @@ play around. To start it:
Then just open <http://localhost:8000> and log in as: **admin**, password **admin**
+To stop the container:
+
+```sudo docker container stop wger.apache```
+
+To start developing again:
+
+```sudo docker container start --attach wger.apache```
+
+
+Building
+--------
+
+If you build this yourself, keep in mind that you **must** build from the
+project root!
+
+```docker build -f extras/docker/apache/Dockerfile --tag wger/apache .```
+
+
Contact
-------
@@ -28,9 +46,10 @@ didn't behave as you expected. We can't fix what we don't know about, so please
report liberally. If you're not sure if something is a bug or not, feel free to
file a bug anyway.
+* gitter: <https://gitter.im/wger-project/wger>
+* issue tracker: <https://github.com/wger-project/wger/issues>
* twitter: <https://twitter.com/wger_de>
* mailing list: <https://groups.google.com/group/wger> / [email protected], no registration needed
-* issue tracker: <https://github.com/wger-project/wger/issues>
Sources
-------
@@ -38,7 +57,6 @@ Sources
All the code and the content is freely available:
* Main repository: <https://github.com/wger-project/wger>
-* Mirror: <https://bitbucket.org/rolandgeider/wger>
Licence
-------
diff --git a/extras/docker/apache/entrypoint.sh b/extras/docker/apache/entrypoint.sh
index b6d03e858..0a644c925 100755
--- a/extras/docker/apache/entrypoint.sh
+++ b/extras/docker/apache/entrypoint.sh
@@ -7,9 +7,7 @@ if [ "${DOWNLOAD_IMGS}" = "TRUE" ]; then
chmod -R g+w ~wger/media
fi
-if [ "${USE_S3}" = "TRUE" ]; then
- /home/wger/venvwrapper collectstatic --no-input
- /home/wger/venvwrapper compress --force
-fi
+/home/wger/venvwrapper collectstatic --no-input
+/home/wger/venvwrapper compress --force
/usr/sbin/apache2ctl -D FOREGROUND
diff --git a/extras/docker/base/Dockerfile b/extras/docker/base/Dockerfile
index 59ef38bd1..e101ce355 100644
--- a/extras/docker/base/Dockerfile
+++ b/extras/docker/base/Dockerfile
@@ -8,30 +8,26 @@
# docker build --tag wger/base .
#
-FROM ubuntu:18.10
+FROM ubuntu:20.04
LABEL maintainer="Roland Geider <[email protected]>"
# Install dependencies
+ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
git \
- libjpeg8-dev \
- libpq-dev \
- libwebp-dev \
locales \
nodejs \
npm \
- python-virtualenv \
python3-dev \
python3-venv \
- sudo \
- virtualenv \
- zlib1g-dev \
+ vim \
+ tmux \
+ sqlite3 \
&& rm -rf /var/lib/apt/lists/*
# Add wger user
RUN adduser wger --disabled-password --gecos ""
-RUN echo "wger ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/wger
diff --git a/extras/docker/base/README.md b/extras/docker/base/README.md
index 4ed161bfe..9693f06a7 100644
--- a/extras/docker/base/README.md
+++ b/extras/docker/base/README.md
@@ -14,9 +14,10 @@ didn't behave as you expected. We can't fix what we don't know about, so please
report liberally. If you're not sure if something is a bug or not, feel free to
file a bug anyway.
+* gitter: <https://gitter.im/wger-project/wger>
+* issue tracker: <https://github.com/wger-project/wger/issues>
* twitter: <https://twitter.com/wger_de>
* mailing list: <https://groups.google.com/group/wger> / [email protected], no registration needed
-* issue tracker: <https://github.com/wger-project/wger/issues>
Sources
-------
@@ -24,7 +25,6 @@ Sources
All the code and the content is freely available:
* Main repository: <https://github.com/wger-project/wger>
-* Mirror: <https://bitbucket.org/rolandgeider/wger>
Licence
-------
diff --git a/extras/docker/development-fedora/Dockerfile b/extras/docker/development-fedora/Dockerfile
index bbe9d1a78..719403355 100644
--- a/extras/docker/development-fedora/Dockerfile
+++ b/extras/docker/development-fedora/Dockerfile
@@ -15,7 +15,7 @@ LABEL maintainer="Roland Geider <[email protected]>"
RUN dnf update;\
dnf install -y python3-devel python-virtualenv \
nodejs npm libjpeg-turbo-devel zlib-devel git \
- tmux sudo redhat-rpm-config gcc python-imaging
+ tmux redhat-rpm-config gcc python-imaging
# Set locale to UTF8, otherwise problems with the encoding can occur, e.g.
# when using the invoke/wger commands and bower
diff --git a/extras/docker/development-fedora/README.md b/extras/docker/development-fedora/README.md
index 561f97f3a..235967ebb 100644
--- a/extras/docker/development-fedora/README.md
+++ b/extras/docker/development-fedora/README.md
@@ -36,6 +36,7 @@ didn't behave as you expected. We can't fix what we don't know about, so please
report liberally. If you're not sure if something is a bug or not, feel free to
file a bug anyway.
+* gitter: <https://gitter.im/wger-project/wger>
* twitter: <https://twitter.com/wger_de>
* mailing list: <https://groups.google.com/group/wger> / [email protected], no registration needed
* issue tracker: <https://github.com/wger-project/wger/issues>
@@ -46,7 +47,6 @@ Sources
All the code and the content is freely available:
* Main repository: <https://github.com/wger-project/wger>
-* Mirror: <https://bitbucket.org/rolandgeider/wger>
Licence
-------
diff --git a/extras/docker/development/Dockerfile b/extras/docker/development/Dockerfile
index b2715e7e8..c6cc47daf 100644
--- a/extras/docker/development/Dockerfile
+++ b/extras/docker/development/Dockerfile
@@ -2,15 +2,28 @@
# Docker image for wger development
#
# Please consult the documentation for usage
-# docker build -t wger/devel .
-# docker run -ti --name wger.devel --publish 8000:8000 wger/devel
+#
+# 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 --publish 8000:8000 --name wger.devel wger/devel
# (in docker) source ~/venv/bin/activate
+# (in docker) python manage.py download-exercise-images (optional, may take some time)
# (in docker) python manage.py runserver 0.0.0.0:8000
#
+# Alternatively, you can bind the local checkout into the container:
+# docker run -ti -v /path/to/this/checkout:/home/wger/src --name wger.devel --publish 8000:8000 wger/devel
+#
+#
+# To stop the container:
+# sudo docker container stop wger.devel
+#
+# To start developing again
+# sudo docker container start --attach wger.devel
#
-
-FROM wger/base
+FROM wger/base:1.9
LABEL maintainer="Roland Geider <[email protected]>"
EXPOSE 8000
@@ -22,20 +35,24 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
-
-# Install dependencies
-RUN apt-get install --no-install-recommends -y vim tmux sqlite3
+# Path to where misc docker files live, relative to the project root
+ARG DOCKER_DIR=./extras/docker/development
# Set up the application
USER wger
-RUN git clone https://github.com/wger-project/wger.git /home/wger/src
+COPY --chown=wger:wger . /home/wger/src
+#RUN git clone https://github.com/wger-project/wger.git /home/wger/src
WORKDIR /home/wger/src
-RUN virtualenv --python python3 /home/wger/venv
+RUN python3 -m venv /home/wger/venv
RUN . /home/wger/venv/bin/activate \
&& pip install --upgrade pip \
+ && pip install wheel \
&& pip install -r requirements_devel.txt \
+ && pip install -r requirements_forked.txt \
&& python setup.py develop \
+ && npm install \
+ && npm install bower \
&& wger create_settings \
--settings-path /home/wger/src/settings.py \
--database-path /home/wger/db/database.sqlite \
@@ -43,21 +60,17 @@ RUN . /home/wger/venv/bin/activate \
--settings-path /home/wger/src/settings.py \
--no-start-server
-# Install node modules for JS linting and download the exercise images
-#
-# Note: it seems there are problems with node and docker, so it's necessary
-# to delete the node_modules folder and install everything again
-# -> https://github.com/npm/npm/issues/9863
-# -> https://github.com/npm/npm/issues/13306
-RUN cd wger \
- && rm -r node_modules \
- && npm install bower \
- && npm install \
- && cd .. \
- && mkdir ~/media \
+# Download the exercise images
+RUN mkdir ~/media \
&& sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings.py \
- && . /home/wger/venv/bin/activate \
- && python manage.py download-exercise-images
+ && . /home/wger/venv/bin/activate
+
+USER root
+RUN apt-get remove -y \
+ build-essential \
+ python-dev \
+ && apt autoremove -y
+USER wger
CMD ["/bin/bash"]
diff --git a/extras/docker/development/README.md b/extras/docker/development/README.md
index b72b4d4d6..2f48966a1 100644
--- a/extras/docker/development/README.md
+++ b/extras/docker/development/README.md
@@ -17,7 +17,7 @@ development instance (vim and tmux are already installed):
```docker run -ti --name wger.devel --publish 8000:8000 wger/devel```
-Then, *within the docker image*, activate the virtualenv
+Then, within the docker image, activate the virtualenv
```source ~/venv/bin/activate```
@@ -27,6 +27,26 @@ and start the development server
Then just open <http://localhost:8000> and log in as: **admin**, password **admin**
+To stop the container:
+
+```sudo docker container stop wger.devel```
+
+To start developing again:
+
+```sudo docker container start --attach wger.devel```
+
+You can also keep the code outside and just bind it into the container:
+
+```docker run -ti -v /path/to/local/project/checkout:/home/wger/src --name wger.devel --publish 8000:8000 wger/devel```
+
+Building
+--------
+
+If you build this yourself, keep in mind that you **must** build from the
+project root!
+
+```docker build -f extras/docker/development/Dockerfile --tag wger/devel .```
+
Contact
-------
@@ -35,9 +55,10 @@ didn't behave as you expected. We can't fix what we don't know about, so please
report liberally. If you're not sure if something is a bug or not, feel free to
file a bug anyway.
+* gitter: <https://gitter.im/wger-project/wger>
+* issue tracker: <https://github.com/wger-project/wger/issues>
* twitter: <https://twitter.com/wger_de>
* mailing list: <https://groups.google.com/group/wger> / [email protected], no registration needed
-* issue tracker: <https://github.com/wger-project/wger/issues>
Sources
-------
@@ -45,7 +66,6 @@ Sources
All the code and the content is freely available:
* Main repository: <https://github.com/wger-project/wger>
-* Mirror: <https://bitbucket.org/rolandgeider/wger>
Licence
-------
diff --git a/requirements.txt b/requirements.txt
index 39daa8c5c..894b48628 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -22,14 +22,15 @@ matplotlib>=3.1
requests
setuptools>=18.5
sphinx
-psycopg2
+#psycopg2
+# Not necessary for devel. Keeping them here for now till a nice solution is found
# AWS
-boto3
+#boto3
# Production
-psycopg2
-python-memcached
+#psycopg2-binary
+#python-memcached
# REST API
django-cors-headers>=3.0