Merge remote-tracking branch 'ungleich-public/master'

This commit is contained in:
PCoder 2022-09-26 10:48:17 +05:30
commit db54e3c3d7
2 changed files with 24 additions and 12 deletions

View file

@ -35,18 +35,21 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/gmba_django/wheels -
FROM python:3.9.6-alpine FROM python:3.9.6-alpine
# create directory for the app user # create directory for the app user
RUN mkdir -p /data/app RUN mkdir -p /home/app
# create the app user # create the app user
RUN addgroup -S app && adduser -S app -G app RUN addgroup -S app && adduser -S app -G app
# create the appropriate directories # create the appropriate directories
ENV HOME=/data/app ENV HOME=/home/app
ENV APP_HOME=/data/app/app ENV APP_HOME=/home/app/gmba_django
RUN mkdir $APP_HOME RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/static RUN mkdir $APP_HOME/static
RUN mkdir $APP_HOME/media RUN mkdir $APP_HOME/media
WORKDIR $APP_HOME
#ADD gmba_django /data/app
#WORKDIR /data/app/gmba_django
# install dependencies # install dependencies
RUN apk update && apk add libpq RUN apk update && apk add libpq
@ -55,15 +58,16 @@ COPY --from=builder /usr/src/gmba_django/requirements.txt .
RUN pip install --no-cache /wheels/* RUN pip install --no-cache /wheels/*
# copy entrypoint.prod.sh # copy entrypoint.prod.sh
COPY ./entrypoint.prod.sh . COPY ./entrypoint.prod.sh /entrypoint.prod.sh
COPY ./init.sh /init.sh COPY ./init.sh /init.sh
RUN sed -i 's/\r$//g' $APP_HOME/entrypoint.prod.sh RUN sed -i 's/\r$//g' /entrypoint.prod.sh
RUN chmod +x $APP_HOME/entrypoint.prod.sh RUN chmod +x /entrypoint.prod.sh
# copy project # copy project
COPY . $APP_HOME #COPY . $APP_HOME
ADD . /home/app/gmba_django
WORKDIR /home/app/gmba_django
# chown all the files to the app user # chown all the files to the app user
RUN chown -R app:app $APP_HOME RUN chown -R app:app $APP_HOME
@ -71,8 +75,11 @@ RUN chown -R app:app $APP_HOME
# change to the app user # change to the app user
USER app USER app
RUN python manage.py collectstatic --noinput #RUN python manage.py collectstatic --noinput
# run entrypoint.prod.sh # run entrypoint.prod.sh
ENTRYPOINT ["./entrypoint.prod.sh"] ENTRYPOINT ["/entrypoint.prod.sh"]
EXPOSE 8000
CMD ["gunicorn", "--bind", "[::]:8000", "--chdir", "/home/app/gmba_django", "--workers", "3", "gmba_django.wsgi:application"]

View file

@ -1 +1,6 @@
python manage.py migrate #!/bin/ash
#python manage.py migrate
python manage.py collectstatic --noinput
#
#gunicorn gmba_django.wsgi:application --bind [::]:8000