tuna2134 commited on
Commit
76a257d
·
1 Parent(s): 73a641d

add: gunicorn使うようにした

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. main.py +7 -2
  3. requirements.txt +1 -1
Dockerfile CHANGED
@@ -8,4 +8,4 @@ COPY requirements.txt .
8
  RUN pip install -r requirements.txt
9
 
10
  COPY . .
11
- CMD ["python3", "main.py"]
 
8
  RUN pip install -r requirements.txt
9
 
10
  COPY . .
11
+ CMD ["gunicorn", "main:app", "-b", "0.0.0.0:8080"]
main.py CHANGED
@@ -14,7 +14,11 @@ BASE_IMAGE = Image.open("images/base.png")
14
  MPLUS_FONT = ImageFont.truetype("fonts/MPLUSRounded1c-Regular.ttf", size=16)
15
 
16
 
17
- def draw_text(im, ofs, string, font="fonts/MPLUSRounded1c-Regular.ttf", size=16, color=(0, 0, 0, 255), split_len=None, padding=4, auto_expand=False, disable_dot_wrap=False):
 
 
 
 
18
 
19
  draw = ImageDraw.Draw(im)
20
  fontObj = ImageFont.truetype(font, size=size)
@@ -125,4 +129,5 @@ def main():
125
  return send_file(res, mimetype="image/png")
126
 
127
 
128
- app.run(host="0.0.0.0", port=3000)
 
 
14
  MPLUS_FONT = ImageFont.truetype("fonts/MPLUSRounded1c-Regular.ttf", size=16)
15
 
16
 
17
+ def draw_text(
18
+ im, ofs, string, font="fonts/MPLUSRounded1c-Regular.ttf", size=16,
19
+ color=(0, 0, 0, 255), split_len=None, padding=4, auto_expand=False,
20
+ disable_dot_wrap=False
21
+ ):
22
 
23
  draw = ImageDraw.Draw(im)
24
  fontObj = ImageFont.truetype(font, size=size)
 
129
  return send_file(res, mimetype="image/png")
130
 
131
 
132
+ if __name__ == "__main__":
133
+ app.run(host="0.0.0.0", port=3000)
requirements.txt CHANGED
@@ -2,4 +2,4 @@ pillow==9.4.0
2
  pilmoji==2.0.2
3
  flask==2.2.3
4
  requests==2.28.2
5
-
 
2
  pilmoji==2.0.2
3
  flask==2.2.3
4
  requests==2.28.2
5
+ gunicorn==20.1.0