mirror of
https://github.com/pinry/pinry.git
synced 2025-11-13 00:25:41 +01:00
Refactor: Use shortter path for project location
This commit is contained in:
@@ -22,7 +22,6 @@ RUN groupadd -g 2300 tmpgroup \
|
|||||||
&& groupdel tmpgroup
|
&& groupdel tmpgroup
|
||||||
|
|
||||||
RUN mkdir /data
|
RUN mkdir /data
|
||||||
RUN mkdir -p /data/logs
|
|
||||||
RUN chown -R www-data:www-data /data
|
RUN chown -R www-data:www-data /data
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@@ -30,12 +29,13 @@ RUN apt-get update \
|
|||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& apt-get autoclean
|
&& apt-get autoclean
|
||||||
|
|
||||||
|
# required for other database options
|
||||||
RUN pip --no-cache-dir install pipenv gunicorn mysqlclient psycopg2 cx-Oracle
|
RUN pip --no-cache-dir install pipenv gunicorn mysqlclient psycopg2 cx-Oracle
|
||||||
|
|
||||||
# COPY and start installation
|
# COPY and start installation
|
||||||
COPY . /srv/www/pinry/
|
COPY . /pinry
|
||||||
|
|
||||||
RUN cd /srv/www/pinry \
|
RUN cd /pinry \
|
||||||
&& pipenv install --three --system --clear
|
&& pipenv install --three --system --clear
|
||||||
|
|
||||||
# config nodejs
|
# config nodejs
|
||||||
@@ -44,14 +44,13 @@ RUN bash n 10
|
|||||||
RUN npm -g install yarn
|
RUN npm -g install yarn
|
||||||
|
|
||||||
# build frontend
|
# build frontend
|
||||||
RUN cd /srv/www/pinry/pinry-spa/ && yarn install && yarn build
|
RUN cd /pinry/pinry-spa/ && yarn install && yarn build
|
||||||
|
|
||||||
# Load in all of our config files.
|
# Load in all of our config files.
|
||||||
ADD docker/nginx/nginx.conf /etc/nginx/nginx.conf
|
ADD docker/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||||
ADD docker/nginx/sites-enabled/default /etc/nginx/sites-enabled/default
|
ADD docker/nginx/sites-enabled/default /etc/nginx/sites-enabled/default
|
||||||
ADD docker/scripts/* /scripts/
|
|
||||||
|
|
||||||
# 80 is for nginx web, /data contains static files and database /start runs it.
|
# 80 is for nginx web, /data contains static files and database /start runs it.
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
CMD ["/scripts/start.sh"]
|
CMD ["/pinry/docker/scripts/start.sh"]
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ server {
|
|||||||
listen 80 default;
|
listen 80 default;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
access_log /data/logs/access.log;
|
access_log /data/nginx-access.log;
|
||||||
error_log /data/logs/error.log;
|
error_log /data/nginx-error.log;
|
||||||
|
|
||||||
root /srv/www/pinry/pinry-spa/dist/;
|
root /pinry/pinry-spa/dist/;
|
||||||
|
|
||||||
location /static {
|
location /static {
|
||||||
alias /data/static;
|
alias /data/static;
|
||||||
@@ -22,7 +22,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /srv/www/pinry/pinry-spa/dist/;
|
root /pinry/pinry-spa/dist/;
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ local_settings_file="/data/local_settings.py"
|
|||||||
# Create local_settings.py
|
# Create local_settings.py
|
||||||
if [ ! -f "${local_settings_file}" ];
|
if [ ! -f "${local_settings_file}" ];
|
||||||
then
|
then
|
||||||
cp "/srv/www/pinry/settings/local_settings.example.py" "${local_settings_file}"
|
cp "/pinry/pinry/settings/local_settings.example.py" "${local_settings_file}"
|
||||||
gen_key
|
gen_key
|
||||||
sed -i "s/secret\_key\_place\_holder/${SECRET_KEY}/" "${local_settings_file}"
|
sed -i "s/secret\_key\_place\_holder/${SECRET_KEY}/" "${local_settings_file}"
|
||||||
ln -s "${local_settings_file}" "/srv/www/pinry/settings/local_settings.py"
|
ln -s "${local_settings_file}" "/pinry/pinry/settings/local_settings.py"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,17 +8,18 @@
|
|||||||
# Authors: Isaac Bythewood
|
# Authors: Isaac Bythewood
|
||||||
# Updated: Aug 19th, 2014
|
# Updated: Aug 19th, 2014
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
PROJECT_ROOT="/pinry"
|
||||||
|
|
||||||
bash /scripts/bootstrap.sh
|
bash /scripts/bootstrap.sh
|
||||||
|
|
||||||
# If static files don't exist collect them
|
# If static files don't exist collect them
|
||||||
cd /srv/www/pinry
|
cd ${PROJECT_ROOT}
|
||||||
python manage.py collectstatic --noinput
|
python manage.py collectstatic --noinput
|
||||||
|
|
||||||
# If database doesn't exist yet create it
|
# If database doesn't exist yet create it
|
||||||
if [ ! -f /data/production.db ]
|
if [ ! -f /data/production.db ]
|
||||||
then
|
then
|
||||||
cd /srv/www/pinry
|
cd ${PROJECT_ROOT}
|
||||||
python manage.py migrate --noinput --settings=pinry.settings.docker
|
python manage.py migrate --noinput --settings=pinry.settings.docker
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -28,5 +29,5 @@ chown -R www-data:www-data /data
|
|||||||
# start all process
|
# start all process
|
||||||
/usr/sbin/nginx
|
/usr/sbin/nginx
|
||||||
|
|
||||||
cd /srv/www/pinry/
|
cd ${PROJECT_ROOT}
|
||||||
/scripts/_start_gunicorn.sh
|
./docker/scripts/_start_gunicorn.sh
|
||||||
|
|||||||
@@ -12,5 +12,4 @@ fi
|
|||||||
|
|
||||||
sudo docker run -d=true -p=80:80 \
|
sudo docker run -d=true -p=80:80 \
|
||||||
-v=${DATA_PATH}:/data \
|
-v=${DATA_PATH}:/data \
|
||||||
-v=${SETTINGS_PATH}:/srv/www/pinry/pinry/settings/local_settings.py \
|
pinry/pinry
|
||||||
pinry/pinry /scripts/start.sh
|
|
||||||
|
|||||||
Reference in New Issue
Block a user