To build image
docker compose build
To fire up containers
docker compose up
Hi @slow999
I learnt some things I never knew were doable in this little project of yours. The docker usage is topnotch. I have gone ahead to revise it for personal use.
My revision is shown below:
version: "3.7"
services:
if_ndo_django:
build: ./web/
image: if_ndo_django
restart: always
container_name: cf_ndo_django
command: >
sh -c "python manage.py collectstatic --noinput
&& uwsgi --ini core.uwsgi.ini"
environment:
DJANGO_SETTINGS_MODULE: core.settings
SECRET_KEY: a989d11be926c6ca2f7035d3e42cb0d1b7e08b
DEBUG: true
volumes:
- ndo-uwsgi-data:/tmp/uwsgi/
- ./web:/code
if_ndo_nginx:
build: ./nginx/
image: if_ndo_nginx
restart: always
container_name: cf_ndo_nginx
volumes:
- ndo-uwsgi-data:/tmp/uwsgi/
- ./web/static:/var/www/core/assets
- ./logs:/var/log/nginx/
ports:
- 8888:80
depends_on:
- if_ndo_django
volumes:
ndo-uwsgi-data:
Part of my revision includes updating the code to Django version 4, touching up the static repository and refactoring the Dockerfile.
web/Dockerfile
FROM python:3.10.7-alpine3.16
ENV PI="pip3 install --cache-dir . --disable-pip-version-check --find-links=."
WORKDIR /code
COPY requirements.txt /code
RUN apk add --no-cache build-base linux-headers && \
pip3 download --cache-dir . --only-binary=:all pip setuptools wheel -r requirements.txt && \
$PI pip setuptools wheel && $PI uwsgi -r requirements.txt && \
apk del build-base linux-headers && rm -rf /var/cache/apk/*
nginx/Dockerfile
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
COPY core.nginx.conf /etc/nginx/sites-available/core.nginx.conf
RUN mkdir /etc/nginx/sites-enabled && ln -s /etc/nginx/sites-available/core.nginx.conf /etc/nginx/sites-enabled/
CMD ["nginx", "-g", "daemon off;"]
Also, I renamed the project from mysite to core. I was able to make these changes because you lead the way. Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.