mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-04-05 08:54:03 -04:00
fix docker image
This commit is contained in:
31
Dockerfile
31
Dockerfile
@@ -1,18 +1,5 @@
|
||||
FROM nikolaik/python-nodejs:python3.10-nodejs17-alpine as base
|
||||
|
||||
# build python dependencies
|
||||
FROM base as python-build
|
||||
WORKDIR /install
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
RUN apk update &&\
|
||||
apk add musl-dev build-base gcc libffi-dev libressl-dev postgresql-dev mariadb-dev cargo &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
COPY app/backend/requirements.txt .
|
||||
RUN python -m pip install --no-cache-dir --upgrade pip &&\
|
||||
pip install --prefix=/install --no-cache-dir -r requirements.txt
|
||||
|
||||
# build svelte app
|
||||
FROM base as npm-build
|
||||
FROM node:17-alpine as npm-build
|
||||
WORKDIR /install
|
||||
COPY app/frontend/package*.json ./
|
||||
RUN npm install
|
||||
@@ -21,15 +8,19 @@ COPY app/frontend/public ./public
|
||||
COPY app/frontend/rollup.config.js ./
|
||||
RUN npm run build
|
||||
|
||||
# build final image
|
||||
FROM base
|
||||
# build python dependencies
|
||||
FROM python:3.10-alpine
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
WORKDIR /app
|
||||
COPY --from=python-build /install /usr/local
|
||||
RUN apk update &&\
|
||||
apk add musl-dev build-base gcc libffi-dev libressl-dev postgresql-dev mariadb-dev nodejs npm iputils nmap curl bash &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
COPY app/backend/requirements.txt .
|
||||
RUN python -m pip install --no-cache-dir --upgrade pip &&\
|
||||
pip install --no-cache-dir -r requirements.txt &&\
|
||||
apk del build-base gcc libffi-dev libressl-dev postgresql-dev
|
||||
COPY app/backend ./backend
|
||||
COPY --from=npm-build /install ./frontend
|
||||
COPY app/run.sh ./
|
||||
RUN apk update &&\
|
||||
apk add iputils nmap curl bash mariadb-dev &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
CMD ["./run.sh"]
|
||||
|
||||
@@ -20,10 +20,10 @@ elif [ "$PING_INTERVAL" -lt 5 ]; then
|
||||
fi
|
||||
|
||||
# init django
|
||||
python manage.py makemigrations
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic --noinput
|
||||
python manage.py shell < setup.py
|
||||
python3 manage.py makemigrations
|
||||
python3 manage.py migrate
|
||||
python3 manage.py collectstatic --noinput
|
||||
python3 manage.py shell < setup.py
|
||||
celery -A backend worker &
|
||||
celery -A backend beat &
|
||||
gunicorn --bind 0.0.0.0:"$DJANGO_PORT" --workers 4 backend.asgi:application -k uvicorn.workers.UvicornWorker &
|
||||
|
||||
@@ -2,8 +2,7 @@ version: "3"
|
||||
services:
|
||||
upsnap_django:
|
||||
container_name: upsnap_django
|
||||
#image: seriousm4x/upsnap:latest
|
||||
build: .
|
||||
image: seriousm4x/upsnap:latest
|
||||
network_mode: host
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user