remove dev setup
This commit is contained in:
parent
0caa321b5d
commit
f63018c6db
6 changed files with 54 additions and 106 deletions
|
@ -12,8 +12,8 @@ services:
|
|||
- internal
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4
|
||||
#volumes:
|
||||
# - "./data/dbadmin:/var/lib/pgadmin"
|
||||
volumes:
|
||||
- "./data/dbadmin:/var/lib/pgadmin"
|
||||
env_file:
|
||||
- ./.env
|
||||
restart: always
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
###########
|
||||
# BUILDER #
|
||||
###########
|
||||
|
||||
# pull official base image
|
||||
FROM python:3.9.5-slim-buster
|
||||
FROM python:3 as builder
|
||||
|
||||
# set work directory
|
||||
WORKDIR /usr/src/app
|
||||
|
@ -9,15 +13,57 @@ ENV PYTHONDONTWRITEBYTECODE 1
|
|||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# install system dependencies
|
||||
RUN apt-get update && apt-get install -y netcat
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends gcc
|
||||
|
||||
# lint
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install flake8
|
||||
COPY . /usr/src/app/
|
||||
RUN flake8 --ignore=E501,F401 .
|
||||
|
||||
# install python dependencies
|
||||
COPY ./requirements.txt .
|
||||
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
|
||||
|
||||
|
||||
#########
|
||||
# FINAL #
|
||||
#########
|
||||
|
||||
# pull official base image
|
||||
FROM python:3
|
||||
|
||||
# create directory for the app user
|
||||
RUN mkdir -p /home/app
|
||||
|
||||
# create the app user
|
||||
RUN addgroup --system app && adduser --system --group app
|
||||
|
||||
# create the appropriate directories
|
||||
ENV HOME=/home/app
|
||||
ENV APP_HOME=/home/app/web
|
||||
RUN mkdir $APP_HOME
|
||||
WORKDIR $APP_HOME
|
||||
|
||||
# install dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends netcat
|
||||
COPY --from=builder /usr/src/app/wheels /wheels
|
||||
COPY --from=builder /usr/src/app/requirements.txt .
|
||||
RUN pip install --upgrade pip
|
||||
COPY ./requirements.txt /usr/src/app/requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
RUN pip install --no-cache /wheels/*
|
||||
|
||||
# copy entrypoint.sh
|
||||
COPY ./entrypoint.sh $APP_HOME
|
||||
|
||||
# copy project
|
||||
COPY . /usr/src/app/
|
||||
COPY . $APP_HOME
|
||||
|
||||
# chown all the files to the app user
|
||||
RUN chown -R app:app $APP_HOME
|
||||
|
||||
# change to the app user
|
||||
USER app
|
||||
|
||||
# run entrypoint.sh
|
||||
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
|
||||
ENTRYPOINT ["/home/app/web/entrypoint.sh"]
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
###########
|
||||
# BUILDER #
|
||||
###########
|
||||
|
||||
# pull official base image
|
||||
FROM python:3.9.5-slim-buster as builder
|
||||
|
||||
# set work directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# install system dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends gcc
|
||||
|
||||
# lint
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install flake8==3.9.1
|
||||
COPY . /usr/src/app/
|
||||
#RUN flake8 --ignore=E501,F401 .
|
||||
|
||||
# install python dependencies
|
||||
COPY ./requirements.txt .
|
||||
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
|
||||
|
||||
|
||||
#########
|
||||
# FINAL #
|
||||
#########
|
||||
|
||||
# pull official base image
|
||||
FROM python:3.9.5-slim-buster
|
||||
|
||||
# create directory for the app user
|
||||
RUN mkdir -p /home/app
|
||||
|
||||
# create the app user
|
||||
RUN addgroup --system app && adduser --system --group app
|
||||
|
||||
# create the appropriate directories
|
||||
ENV HOME=/home/app
|
||||
ENV APP_HOME=/home/app/web
|
||||
RUN mkdir $APP_HOME
|
||||
WORKDIR $APP_HOME
|
||||
|
||||
# install dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends netcat
|
||||
COPY --from=builder /usr/src/app/wheels /wheels
|
||||
COPY --from=builder /usr/src/app/requirements.txt .
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install --no-cache /wheels/*
|
||||
|
||||
# copy entrypoint-prod.sh
|
||||
COPY ./entrypoint.prod.sh $APP_HOME
|
||||
|
||||
# copy project
|
||||
COPY . $APP_HOME
|
||||
|
||||
# chown all the files to the app user
|
||||
RUN chown -R app:app $APP_HOME
|
||||
|
||||
# change to the app user
|
||||
USER app
|
||||
|
||||
# run entrypoint.prod.sh
|
||||
ENTRYPOINT ["/home/app/web/entrypoint.prod.sh"]
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$DATABASE" = "postgres" ]
|
||||
then
|
||||
echo "Waiting for postgres..."
|
||||
|
||||
while ! nc -z $SQL_HOST $SQL_PORT; do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
echo "PostgreSQL started"
|
||||
fi
|
||||
|
||||
exec "$@"
|
|
@ -11,6 +11,4 @@ then
|
|||
echo "PostgreSQL started"
|
||||
fi
|
||||
|
||||
python manage.py create_db
|
||||
|
||||
exec "$@"
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
FROM overv/openstreetmap-tile-server:2.3.0
|
||||
EXPOSE 80
|
||||
# Remove all original style files
|
||||
RUN rm -rf /home/renderer/src/openstreetmap-carto/style/*.mss
|
||||
RUN rm -fr /home/renderer/src/openstreetmap-carto/project.mml
|
||||
# Add custom style files
|
||||
ADD carto-style /home/renderer/src/openstreetmap-carto
|
||||
# Recompile the stylesheet
|
||||
RUN cd /home/renderer/src/openstreetmap-carto \
|
||||
&& carto project.mml > mapnik.xml \
|
||||
&& scripts/get-external-data.py
|
||||
|
||||
##TODO ADD map-data/
|
Loading…
Reference in a new issue