diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c79e6d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM frolvlad/alpine-python2 + +WORKDIR /usr/src/app + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +CMD [ "python", "./main.py" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c1c2ee5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3.8' +services: + nginx: + image: nginx:1.21.1 + container_name: nginx + depends_on: + - flask + volumes: + - ./nginx-docker.conf:/etc/nginx/conf.d/default.conf + networks: + - my-network + ports: + - 80:80 + flask: + build: + context: ./ + dockerfile: Dockerfile + container_name: hilite + networks: + - my-network + +networks: + my-network: diff --git a/nginx-docker.conf b/nginx-docker.conf new file mode 100644 index 0000000..8d6f1b2 --- /dev/null +++ b/nginx-docker.conf @@ -0,0 +1,16 @@ +server { + root ./static; + server_name hilite.dev; + + proxy_set_header Host $host; + + location / { + if (-f $request_filename) { + access_log off; + } + + if (!-f $request_filename) { + proxy_pass http://hilite:5000; + } + } +}