-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
79 lines (67 loc) · 2.11 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# ==========================================
# Copyright (c) 2020 Debmalya Pramanik #
# ==========================================
# -------------------------------------------------------------------
# Mnemonic: Dockerfile
# Abstract: Hello-World Flask REST-API Docker Template
#
# Date: 15 April 2021
# Author: Debmalya Pramanik
# -------------------------------------------------------------------
FROM tiangolo/uwsgi-nginx-flask:python3.8
# add maintainer tag
LABEL maintainer="Debmalya Pramanik <[email protected]>"
# add dummy app
ENV INSTALL_PATH /usr/src/helloworld
RUN mkdir -p $INSTALL_PATH
# install net-tools mysql-client
# using mariadb-client inplace of mysql-client
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
net-tools \
&& apt-get install -y --no-install-recommends mariadb-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# set working directory
WORKDIR $INSTALL_PATH
# logging addition is included
# change the directory `app` as required
RUN mkdir -p /tmp/logs/app/
# setting up environment variables
# application specific ENVIRONMENT VARIABLES
# can be either set from this Dockerfile
# or individual file can be configured under
# `.env` and `./app/main/.env` directory.
# getting started, specific environment variables
# are defined in Dockerfile for understanding as
# mentioned below:
#
# ENVIRONMENT VARIABLES for `.env`
#
# ENV port
# ENV host
# ENV PROJECT_ENV_NAME
#
# ENVIRONMENT VARIABLES for `./app/main/.env`
#
# ENV database_host
# ENV database_port
# ENV username
# ENV password
# ENV DATABASE_URL
# ENV dev_db
#
# NOTE - dummy `.env` files are present with
# an extension `.env.bkp`
# setup flask environment
# install all requirements
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
# copy all files and folder to docker
COPY . .
# run the application in docker environment
# you can use the wsgi service to start the application
# or the default python can also be used
# run create_db to create all the tables using flask
CMD [ "python", "./create_db.py" ]
CMD [ "python", "./manage.py" ]