automated push from the terminal
This commit is contained in:
51
Dockerfile
51
Dockerfile
@@ -1,47 +1,20 @@
|
|||||||
|
FROM python:3.8
|
||||||
|
|
||||||
# base image
|
ENV DockerHOME=/home/app/webapp
|
||||||
|
|
||||||
FROM python:3.8
|
|
||||||
|
|
||||||
# setup environment variable
|
|
||||||
|
|
||||||
ENV DockerHOME=/home/app/webapp
|
|
||||||
|
|
||||||
# set work directory
|
|
||||||
|
|
||||||
RUN mkdir -p $DockerHOME
|
|
||||||
|
|
||||||
# where your code lives
|
|
||||||
|
|
||||||
WORKDIR $DockerHOME
|
|
||||||
|
|
||||||
# set environment variables
|
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE 1
|
ENV PYTHONDONTWRITEBYTECODE 1
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
RUN mkdir -p $DockerHOME
|
||||||
|
WORKDIR $DockerHOME
|
||||||
|
|
||||||
# install dependencies
|
#RUN pip install --upgrade pip
|
||||||
|
RUN pip install "pip<24.1"
|
||||||
RUN pip install --upgrade pip
|
COPY requirements.txt .
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
# copy whole project to your docker home directory.
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# run this command to install all dependencies
|
EXPOSE 8000
|
||||||
|
|
||||||
RUN pip install -r requirements.txt
|
# Use a shell script or combined command for runtime tasks
|
||||||
|
CMD python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8000
|
||||||
RUN python3 manage.py makemigrations
|
|
||||||
|
|
||||||
RUN python3 manage.py migrate
|
|
||||||
|
|
||||||
|
|
||||||
# port where the Django app runs
|
|
||||||
|
|
||||||
EXPOSE 8000
|
|
||||||
|
|
||||||
# start server
|
|
||||||
|
|
||||||
CMD python manage.py runserver 0.0.0.0:8000
|
|
||||||
|
|||||||
53
compose.bash
53
compose.bash
@@ -1,52 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
##
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
set -x
|
# 1. Shut down existing containers
|
||||||
|
|
||||||
##
|
|
||||||
|
|
||||||
reset
|
|
||||||
|
|
||||||
clear
|
|
||||||
|
|
||||||
##
|
|
||||||
|
|
||||||
docker compose down --remove-orphans
|
docker compose down --remove-orphans
|
||||||
|
|
||||||
docker compose up -d
|
# 2. Build and start containers in the background
|
||||||
|
# The Dockerfile's CMD will handle migrations and runserver automatically.
|
||||||
|
docker compose up -d --build
|
||||||
|
|
||||||
sleep 8
|
# 3. (Optional) Check the logs to ensure the migrations finished successfully
|
||||||
|
docker compose logs -f
|
||||||
########
|
|
||||||
|
|
||||||
###docker-compose -f postgres.yaml pull
|
|
||||||
|
|
||||||
#python3 manage.py dumpdata
|
|
||||||
## This will IRREVERSIBLY DESTROY all data currently in the "maverickdb" database, and return each table to an empty state.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### python3 manage.py flush
|
|
||||||
|
|
||||||
### python3 manage.py sqlflush
|
|
||||||
|
|
||||||
#python3 manage.py sqlmigrate
|
|
||||||
|
|
||||||
##python3 manage.py sqlsequencereset
|
|
||||||
|
|
||||||
#python3 manage.py generateschema
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
python3 manage.py makemigrations
|
|
||||||
|
|
||||||
python3 manage.py migrate
|
|
||||||
|
|
||||||
#python3 manage.py squashmigrations bikes
|
|
||||||
|
|
||||||
#python3 manage.py optimizemigration
|
|
||||||
|
|
||||||
python3 manage.py runserver 0.0.0.0:8888
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
card-players-unite-postgres:
|
card-players-unite-postgres:
|
||||||
@@ -28,6 +26,8 @@ services:
|
|||||||
|
|
||||||
card-players-unite-pgadmin:
|
card-players-unite-pgadmin:
|
||||||
|
|
||||||
|
build: .
|
||||||
|
|
||||||
container_name: card-players-unite-pgadmin
|
container_name: card-players-unite-pgadmin
|
||||||
|
|
||||||
image: dpage/pgadmin4
|
image: dpage/pgadmin4
|
||||||
|
|||||||
Reference in New Issue
Block a user