Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Refactor docker build to not use git checkout

Scott Peshakaec06ea70b99
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..00b49fa92
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+venv
+node_modules
+**/__pycache__
+*.egg-info
diff --git a/.gitignore b/.gitignore
index 080429a93..22760faf3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,6 +59,8 @@ target/
# IDE
.idea/
-# External Libraries
+# External Libraries
wger/core/static/bower_components
node_modules
+
+venv
diff --git a/extras/docker/apache/Dockerfile b/extras/docker/apache/Dockerfile
index 44b088c19..423ce954a 100644
--- a/extras/docker/apache/Dockerfile
+++ b/extras/docker/apache/Dockerfile
@@ -19,6 +19,9 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
+# Path to where misc docker files live, relative to the project root
+ARG DOCKER_DIR=./extras/docker/apache
+
# Install dependencies
RUN apt-get update \
@@ -29,7 +32,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*
# Configure apache
-ADD wger.conf /etc/apache2/sites-available/
+COPY ${DOCKER_DIR}/wger.conf /etc/apache2/sites-available/
RUN a2dissite 000-default.conf \
&& a2enmod headers \
&& a2ensite wger \
@@ -38,18 +41,18 @@ RUN a2dissite 000-default.conf \
&& usermod -G wger www-data
# Configure cron
-ADD crontab /etc/cron.d/wger
-ADD venvwrapper /home/wger/venvwrapper
+COPY ${DOCKER_DIR}/crontab /etc/cron.d/wger
+COPY ${DOCKER_DIR}/venvwrapper /home/wger/venvwrapper
RUN chmod 0644 /etc/cron.d/wger \
&& chmod +x /home/wger/venvwrapper \
&& touch /var/log/cron.log
+COPY --chown=wger:www-data . /home/wger/src
+
# Set up the application
RUN ln -s /home/wger/static/CACHE /var/www
USER wger
-RUN git clone -b ${SOURCE_BRANCH:-master} https://github.com/wger-project/wger.git /home/wger/src \
- && git -C /home/wger/src rev-parse HEAD
WORKDIR /home/wger/src
RUN virtualenv --python python3 /home/wger/venv