2023-10-26 12:31:52 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# To build the Docker image with the necessary dependencies:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# docker build --tag sfconservancy.org-bookworm --file Dockerfile-debian-bookworm .
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							
								
									
										
										
										
											2024-02-02 13:38:27 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# [FIRST RUN ONLY] If you don't have an existing copy of the database, run:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# touch conservancy-website.sqlite3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Start the application with:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# docker run --tty --interactive --rm=true --publish=8000:8000 \
							 | 
						
					
						
							
								
									
										
										
										
											2023-10-26 12:31:52 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#   --mount type=bind,source=$(pwd),target=/var/www/website \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#   --mount type=bind,source=$(pwd)/conservancy-website.sqlite3,target=/var/lib/www/database/conservancy-website.sqlite3 \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#   sfconservancy.org-bookworm:latest
							 | 
						
					
						
							
								
									
										
										
										
											2024-02-02 13:38:27 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# [FIRST RUN ONLY] In a separate terminal, run `docker ps` noting "CONTAINER ID".
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Then run the database migrations with:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# docker exec -it [CONTAINER ID] /usr/bin/python3 manage.py migrate
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Visit the site at http://127.0.0.1:8000
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-13 13:33:27 +10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ARG DEBIAN_FRONTEND=noninteractive
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FROM debian:bookworm
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN apt-get update && apt-get upgrade -y
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN apt-get install -y python3 python3-pip python3-wheel sqlite3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN apt-get install -y python3-django python3-bs4 python3-html5lib python3-django-countries
							 | 
						
					
						
							
								
									
										
										
										
											2023-10-26 12:31:52 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								COPY ./requirements.txt /var/www/website/requirements.txt
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WORKDIR /var/www/website/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN python3 -m pip install -r requirements.txt --break-system-packages
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-13 13:33:27 +10:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN python3 -m pip freeze
							 | 
						
					
						
							
								
									
										
										
										
											2023-10-26 12:31:52 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ENTRYPOINT ["python3", "/var/www/website/manage.py", "runserver", "0.0.0.0:8000"]
							 |