-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker-compose-demo/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,82 @@ | ||
|
||
db: | ||
# get the latest mysql server | ||
image: mysql:5.6 | ||
|
||
# Set db environment | ||
environment: | ||
MYSQL_ROOT_PASSWORD: my-secret-pw | ||
|
||
# to export volume, as recommeded in https://registry.hub.docker.com/u/library/mysql/ | ||
volumes: | ||
- "./mysql-data:/var/lib/mysql" | ||
- "/etc/localtime:/etc/localtime:ro" | ||
|
||
|
||
# a variant of db image using postgresql Database | ||
# db: | ||
# # get the latest postgres server | ||
# image: postgres:9.6 | ||
# | ||
# # Set db environment | ||
# environment: | ||
# POSTGRES_PASSWORD: my-secret-pw | ||
# | ||
# # to export volume, as recommeded in https://registry.hub.docker.com/u/library/mysql/ | ||
# volumes: | ||
# - "./postgres-data:/var/lib/postgresql/data" | ||
# - "/etc/localtime:/etc/localtime:ro" | ||
|
||
|
||
uwsgi: | ||
# a custom image for django | ||
build: ./uwsgi | ||
|
||
# exec a different command from image | ||
command: uwsgi --ini /var/uwsgi/mysite_uwsgi.ini | ||
|
||
# set working dir for uwsgi | ||
working_dir: /var/uwsgi/ | ||
|
||
# define volumes | ||
volumes: | ||
- "./django-data/:/var/uwsgi/" | ||
- "/etc/localtime:/etc/localtime:ro" | ||
|
||
# Expose the default port | ||
|
||
# link container to database | ||
links: | ||
- db | ||
|
||
|
||
nginx: | ||
# a custom image for NGINX | ||
build: ./nginx | ||
|
||
volumes: | ||
- "/etc/localtime:/etc/localtime:ro" | ||
- "./nginx/conf.d/:/etc/nginx/conf.d/" | ||
|
||
# get volumes from uwsgi | ||
volumes_from: | ||
- uwsgi | ||
|
||
ports: | ||
- "10080:80" | ||
|
||
# link container uwsgi | ||
links: | ||
- uwsgi | ||
version: "3.2" | ||
services: | ||
# Create a composed Django-Postgres-NGINX instance | ||
db: | ||
# get the latest mysql server | ||
image: mariadb:10.1 | ||
|
||
# Set db environment | ||
environment: | ||
MYSQL_ROOT_PASSWORD: my-secret-pw | ||
|
||
# to export volume, as recommeded in https://registry.hub.docker.com/u/library/mysql/ | ||
volumes: | ||
- type: bind | ||
source: ./mysql-data/ | ||
target: /var/lib/mysql | ||
|
||
|
||
# # a variant of db image using postgresql Database | ||
# pg: | ||
# # get the latest postgres server | ||
# image: postgres:9.6 | ||
# | ||
# # Set db environment | ||
# environment: | ||
# POSTGRES_PASSWORD: my-secret-pw | ||
# | ||
# # to export volume, as recommeded in https://registry.hub.docker.com/u/library/mysql/ | ||
# volumes: | ||
# - type: bind | ||
# source: ./postgres-data/ | ||
# target: /var/lib/postgresql/data | ||
|
||
|
||
uwsgi: | ||
# a custom image for django | ||
build: ./uwsgi | ||
|
||
# exec a different command from image | ||
command: uwsgi --ini /var/uwsgi/mysite_uwsgi.ini | ||
|
||
# set working dir for uwsgi | ||
working_dir: /var/uwsgi/ | ||
|
||
# define volumes | ||
volumes: | ||
- type: bind | ||
source: ./django-data/ | ||
target: /var/uwsgi/ | ||
|
||
# Expose the default port | ||
|
||
# link container to database | ||
links: | ||
- db | ||
- pg | ||
|
||
|
||
nginx: | ||
# a custom image for NGINX | ||
build: ./nginx | ||
|
||
volumes: | ||
- type: bind | ||
source: ./nginx/conf.d/ | ||
target: /etc/nginx/conf.d/ | ||
|
||
- type: bind | ||
source: ./django-data/ | ||
target: /var/uwsgi/ | ||
|
||
ports: | ||
- "10080:80" | ||
|
||
# link container uwsgi | ||
links: | ||
- uwsgi | ||
|
||
|
||
networks: | ||
default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
|
||
# | ||
# VERSION 0.2 | ||
# DOCKER-VERSION 1.9.1 | ||
# AUTHOR: Paolo Cozzi <paolo.cozzi@ptp.it> | ||
# VERSION 0.3 | ||
# DOCKER-VERSION 17.05.0-ce | ||
# AUTHOR: Paolo Cozzi <paolo.cozzi@ibba.cnr.it> | ||
# DESCRIPTION: A nginx container to work with django | ||
# TO_BUILD: docker build --rm -t django_nginx . | ||
# TO_RUN: docker run -d -P django_nginx | ||
# TO_TAG: docker tag django_nginx:latest django_nginx:0.2 | ||
# TO_TAG: docker tag django_nginx:latest django_nginx:0.3 | ||
# | ||
|
||
# Get the last stable nginx image | ||
FROM nginx:1.11 | ||
FROM nginx:1.16 | ||
|
||
MAINTAINER Paolo Cozzi <[email protected]> | ||
# MAINTAINER is deprecated. Use LABEL instead | ||
LABEL maintainer="[email protected]" | ||
|
||
# Copy nginx configuration file in conf.d directory | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
|
||
# | ||
# VERSION 0.5 | ||
# DOCKER-VERSION 1.9.1 | ||
# AUTHOR: Paolo Cozzi <paolo.cozzi@ptp.it> | ||
# DESCRIPTION: A django container working on LTS django 1.11 on python 3 | ||
# VERSION 0.6 | ||
# DOCKER-VERSION 17.05.0-ce | ||
# AUTHOR: Paolo Cozzi <paolo.cozzi@ibba.cnr.it> | ||
# DESCRIPTION: A django container working on LTS django 2.2 on python 3 | ||
# TO_BUILD: docker build --rm -t django_uwsgi . | ||
# TO_RUN: docker run -d -P django_uwsgi | ||
# TO_TAG: docker tag django_uwsgi:latest django_uwsgi:0.5 | ||
# TO_TAG: docker tag django_uwsgi:latest django_uwsgi:0.6 | ||
# | ||
|
||
# The official django image is deprecated in favor of the standard python image | ||
FROM python:3.6 | ||
FROM python:3.7 | ||
|
||
MAINTAINER Paolo Cozzi <[email protected]> | ||
# MAINTAINER is deprecated. Use LABEL instead | ||
LABEL maintainer="[email protected]" | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
uwsgi | ||
mysqlclient | ||
psycopg2 | ||
Django==1.11 | ||
Django==2.2.1 |