Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Commit 5f4ef66

Browse files
author
renzon
committed
First try to insert docker to run nginx and vaurien
1 parent 36185dc commit 5f4ef66

File tree

3 files changed

+114
-2
lines changed

3 files changed

+114
-2
lines changed

17-futures/countries/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Use an official Python runtime as a base image
2+
FROM centos
3+
4+
# Set the working directory to /app
5+
WORKDIR /app
6+
7+
# Copy the current directory contents into the container at /app
8+
ADD . /app
9+
10+
#Unzip flag files
11+
RUN yum install -y unzip
12+
RUN unzip flags.zip
13+
14+
#Install nginx
15+
RUN yum install -y epel-release
16+
RUN yum install -y nginx
17+
18+
#Setup Nginx
19+
RUN mv -f nginx.conf /etc/nginx/nginx.conf
20+
21+
#Install vaurien
22+
RUN yum install -y centos-release-scl gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel python-devel python-pip
23+
RUN pip install vaurien
24+
25+
26+
27+
28+
29+
30+
31+
# Install any needed packages specified in requirements.txt
32+
#RUN pip install -r requirements.txt
33+
34+
# Make port 80 available to the world outside this container
35+
#EXPOSE 80
36+
37+
# Define environment variable
38+
#ENV NAME World
39+
40+
# Run app.py when the container launches
41+
#CMD ["python", "app.py"]

17-futures/countries/flags.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
import os
1414
import time
1515
import sys
16+
from itertools import product
1617

1718
import requests # <1>
1819

19-
POP20_CC = ('CN IN US ID BR PK NG BD RU JP '
20-
'MX PH VN ET EG DE IR TR CD FR').split() # <2>
20+
import string
21+
22+
23+
POP20_CC = tuple(''.join(t) for t in product(string.ascii_uppercase,string.ascii_uppercase)) # <2>
2124

2225
BASE_URL = 'http://flupy.org/data/flags' # <3>
2326

17-futures/countries/nginx.conf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# For more information on configuration, see:
2+
# * Official English Documentation: http://nginx.org/en/docs/
3+
# * Official Russian Documentation: http://nginx.org/ru/docs/
4+
5+
user nginx;
6+
worker_processes auto;
7+
error_log /var/log/nginx/error.log;
8+
pid /run/nginx.pid;
9+
10+
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
11+
include /usr/share/nginx/modules/*.conf;
12+
13+
events {
14+
worker_connections 1024;
15+
}
16+
17+
http {
18+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
19+
'$status $body_bytes_sent "$http_referer" '
20+
'"$http_user_agent" "$http_x_forwarded_for"';
21+
22+
access_log /var/log/nginx/access.log main;
23+
24+
sendfile on;
25+
tcp_nopush on;
26+
tcp_nodelay on;
27+
keepalive_timeout 65;
28+
types_hash_max_size 2048;
29+
30+
include /etc/nginx/mime.types;
31+
default_type application/octet-stream;
32+
33+
# Load modular configuration files from the /etc/nginx/conf.d directory.
34+
# See http://nginx.org/en/docs/ngx_core_module.html#include
35+
# for more information.
36+
include /etc/nginx/conf.d/*.conf;
37+
38+
server {
39+
listen 80 default_server;
40+
listen [::]:80 default_server;
41+
server_name _;
42+
root /usr/share/nginx/html;
43+
44+
# Load configuration files for the default server block.
45+
include /etc/nginx/default.d/*.conf;
46+
47+
location / {
48+
}
49+
50+
error_page 404 /404.html;
51+
location = /40x.html {
52+
}
53+
54+
error_page 500 502 503 504 /50x.html;
55+
location = /50x.html {
56+
}
57+
}
58+
59+
server {
60+
listen 8001;
61+
62+
location /flags/ {
63+
root /app/;
64+
}
65+
}
66+
67+
68+
}

0 commit comments

Comments
 (0)