Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions template/python27-flask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ RUN chown app /home/app

USER app

ENV PATH=$PATH:/home/app/.local/bin
ENV PATH=$PATH:/home/app/python/bin
ENV PYTHONPATH=/home/app/python

WORKDIR /home/app/

Expand All @@ -28,7 +29,7 @@ RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /home/app/function/
COPY --chown=app:app function/requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
RUN pip install --no-cache-dir --target=/home/app/python -r requirements.txt

WORKDIR /home/app/

Expand Down
9 changes: 9 additions & 0 deletions template/python27-flask/index.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import site

# The function's own dependencies are installed to a fixed path rather than
# a $HOME-derived one, so that they are still found when the platform runs
# the container as an arbitrary uid. Register it as a site directory rather
# than relying on PYTHONPATH alone, so that any .pth files shipped by those
# dependencies are processed as they would be in site-packages.
site.addsitedir("/home/app/python")

# Copyright (c) Alex Ellis 2017. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

Expand Down
5 changes: 3 additions & 2 deletions template/python3-flask-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN addgroup --system app \

USER app

ENV PATH=$PATH:/home/app/.local/bin
ENV PATH=$PATH:/home/app/python/bin
ENV PYTHONPATH=/home/app/python

WORKDIR /home/app/

Expand All @@ -40,7 +41,7 @@ RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /home/app/function/
COPY --chown=app:app function/requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
RUN pip install --no-cache-dir --target=/home/app/python -r requirements.txt

#install function code
USER root
Expand Down
9 changes: 9 additions & 0 deletions template/python3-flask-debian/index.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import site

# The function's own dependencies are installed to a fixed path rather than
# a $HOME-derived one, so that they are still found when the platform runs
# the container as an arbitrary uid. Register it as a site directory rather
# than relying on PYTHONPATH alone, so that any .pth files shipped by those
# dependencies are processed as they would be in site-packages.
site.addsitedir("/home/app/python")

# Copyright (c) Alex Ellis 2017. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

Expand Down
5 changes: 3 additions & 2 deletions template/python3-flask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ RUN chown app /home/app

USER app

ENV PATH=$PATH:/home/app/.local/bin
ENV PATH=$PATH:/home/app/python/bin
ENV PYTHONPATH=/home/app/python

WORKDIR /home/app/

Expand All @@ -37,7 +38,7 @@ RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /home/app/function/
COPY --chown=app:app function/requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
RUN pip install --no-cache-dir --target=/home/app/python -r requirements.txt

#install function code
USER root
Expand Down
9 changes: 9 additions & 0 deletions template/python3-flask/index.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import site

# The function's own dependencies are installed to a fixed path rather than
# a $HOME-derived one, so that they are still found when the platform runs
# the container as an arbitrary uid. Register it as a site directory rather
# than relying on PYTHONPATH alone, so that any .pth files shipped by those
# dependencies are processed as they would be in site-packages.
site.addsitedir("/home/app/python")

# Copyright (c) Alex Ellis 2017. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

Expand Down
5 changes: 3 additions & 2 deletions template/python3-http-debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN addgroup --system app \

USER app

ENV PATH=$PATH:/home/app/.local/bin
ENV PATH=$PATH:/home/app/python/bin
ENV PYTHONPATH=/home/app/python

WORKDIR /home/app/

Expand All @@ -37,7 +38,7 @@ RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /home/app/function/
COPY --chown=app:app function/requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
RUN pip install --no-cache-dir --target=/home/app/python -r requirements.txt

USER root
COPY --chown=app:app function/ .
Expand Down
9 changes: 9 additions & 0 deletions template/python3-http-debian/index.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/usr/bin/env python
import site

# The function's own dependencies are installed to a fixed path rather than
# a $HOME-derived one, so that they are still found when the platform runs
# the container as an arbitrary uid. Register it as a site directory rather
# than relying on PYTHONPATH alone, so that any .pth files shipped by those
# dependencies are processed as they would be in site-packages.
site.addsitedir("/home/app/python")

from flask import Flask, request, jsonify
from waitress import serve
import os
Expand Down
5 changes: 3 additions & 2 deletions template/python3-http/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ RUN chown app /home/app

USER app

ENV PATH=$PATH:/home/app/.local/bin
ENV PATH=$PATH:/home/app/python/bin
ENV PYTHONPATH=/home/app/python

WORKDIR /home/app/

Expand All @@ -35,7 +36,7 @@ RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /home/app/function/
COPY --chown=app:app function/requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
RUN pip install --no-cache-dir --target=/home/app/python -r requirements.txt

# install function code
USER root
Expand Down
9 changes: 9 additions & 0 deletions template/python3-http/index.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/usr/bin/env python
import site

# The function's own dependencies are installed to a fixed path rather than
# a $HOME-derived one, so that they are still found when the platform runs
# the container as an arbitrary uid. Register it as a site directory rather
# than relying on PYTHONPATH alone, so that any .pth files shipped by those
# dependencies are processed as they would be in site-packages.
site.addsitedir("/home/app/python")

from flask import Flask, request, jsonify
from waitress import serve
import os
Expand Down
Loading