Advertisement
Guest User

Untitled

a guest
Mar 28th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. ### Slim version
  2.  
  3. FROM python:2.7-slim
  4. MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>
  5.  
  6. RUN apt-get update && apt-get install -qq -y \
  7. build-essential libpq-dev libffi-dev --no-install-recommends
  8.  
  9. ENV INSTALL_PATH /bsawf
  10. RUN mkdir -p $INSTALL_PATH
  11.  
  12. WORKDIR $INSTALL_PATH
  13.  
  14. COPY requirements.txt requirements.txt
  15. RUN pip install -r requirements.txt
  16.  
  17. COPY . .
  18.  
  19. CMD gunicorn -b 0.0.0.0:8000 --access-logfile - "bsawf.app:create()"
  20.  
  21. ### Alpine based Dockerfile
  22.  
  23. FROM python:2.7-alpine
  24. MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>
  25.  
  26. RUN apk update && apk add build-base postgresql-dev libffi-dev
  27.  
  28. ENV INSTALL_PATH /bsawf
  29. RUN mkdir -p $INSTALL_PATH
  30.  
  31. WORKDIR $INSTALL_PATH
  32.  
  33. COPY requirements.txt requirements.txt
  34. RUN pip install -r requirements.txt
  35.  
  36. COPY . .
  37.  
  38. CMD gunicorn -b 0.0.0.0:8000 --access-logfile - "bsawf.app:create()"
  39.  
  40. ### Optimized Alpine based Dockerfile
  41.  
  42. FROM python:2.7-alpine
  43. MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>
  44.  
  45. ENV INSTALL_PATH /bsawf
  46. RUN mkdir -p $INSTALL_PATH
  47.  
  48. WORKDIR $INSTALL_PATH
  49.  
  50. COPY requirements.txt requirements.txt
  51. RUN apk add --no-cache --virtual .build-deps \
  52. build-base postgresql-dev libffi-dev \
  53. && pip install -r requirements.txt \
  54. && find /usr/local \
  55. \( -type d -a -name test -o -name tests \) \
  56. -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
  57. -exec rm -rf '{}' + \
  58. && runDeps="$( \
  59. scanelf --needed --nobanner --recursive /usr/local \
  60. | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
  61. | sort -u \
  62. | xargs -r apk info --installed \
  63. | sort -u \
  64. )" \
  65. && apk add --virtual .rundeps $runDeps \
  66. && apk del .build-deps
  67.  
  68. COPY . .
  69.  
  70. CMD gunicorn -b 0.0.0.0:8000 --access-logfile - "bsawf.app:create()"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement