Created
August 16, 2015 01:34
-
-
Save davidrusu/4218adfcc2be74c4c8f8 to your computer and use it in GitHub Desktop.
docker and docker-compose
This file contains hidden or 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
FROM tutum/nginx | |
RUN rm /etc/nginx/sites-enabled/default | |
ADD sites-enabled/ /etc/nginx/sites-enabled | |
ADD static/ /www/static | |
# the directory structure of the nginx component: | |
# ./nginx | |
# ├── Dockerfile | |
# ├── sites-enabled | |
# │ └── app | |
# └── static | |
# └── place_holder | |
# | |
# and nginx/sites-enables/app is in the next file |
This file contains hidden or 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
FROM python:3.4 # replace this whatever nodejs image you want, look on dockerhub | |
ADD . /code | |
WORKDIR /code | |
RUN pip install -r requirements.txt # do whatever you need to install the dependencies |
This file contains hidden or 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
server { | |
listen 80; | |
server_name your_server_domain.com; | |
charset utf-8; | |
location /static { | |
alias /www/static; | |
} | |
location / { | |
proxy_pass http://web:8000; | |
# Set HTTP headers so that our app knows | |
# where the requests really come from | |
proxy_set_header HOST $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
This file contains hidden or 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
nginx: | |
build: ./nginx | |
ports: | |
- "80:80" | |
volumes: | |
- /www/static | |
links: | |
- web:web | |
web: | |
build: . | |
command: command to start your server | |
volumes: | |
- .:code | |
links: | |
- pg | |
environment: | |
DEBUG: True | |
DB_NAME: PG_1_PORT_5432_TCP_ADDR | |
pg: | |
restart: always | |
image: postgres | |
ports: | |
- 5432:5432 | |
environment: | |
POSTGRES_PASSWORD: pg_pass | |
POSTGRES_USER: pg_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment