Skip to content

Update arm templates to use multi-arch watchdog #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2019
Merged
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
26 changes: 20 additions & 6 deletions template/python27-flask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,34 @@ ARG ADDITIONAL_PACKAGE
# Alternatively use ADD https:// (which will not be cached by Docker builder)
RUN apk --no-cache add ${ADDITIONAL_PACKAGE}

WORKDIR /root/
# Add non root user
RUN addgroup -S app && adduser app -S -G app
RUN chown app /home/app

USER app

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

WORKDIR /home/app/

COPY index.py .
COPY requirements.txt .
USER root
RUN pip install -r requirements.txt
COPY index.py .
USER app

RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /root/function/
WORKDIR /home/app/function/
COPY function/requirements.txt .
RUN pip install -r requirements.txt
RUN pip install --user -r requirements.txt

WORKDIR /home/app/

WORKDIR /root/
COPY function function
USER root
COPY function function
RUN chown -R app:app ./
USER app

ENV fprocess="python index.py"
ENV cgi_headers="true"
Expand Down
37 changes: 25 additions & 12 deletions template/python3-flask-armhf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
FROM openfaas/of-watchdog:0.5.3 as watchdog
FROM armhf/python:3.6-alpine

# Alternatively use ADD https:// (which will not be cached by Docker builder)
RUN apk --no-cache add curl \
&& echo "Pulling watchdog binary from Github." \
&& curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.5.0/of-watchdog-armhf > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog \
&& apk del curl --no-cache
ARG ADDITIONAL_PACKAGE

COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog

RUN apk --no-cache add musl-dev gcc make openssl-dev libffi-dev

WORKDIR /root/
# Add non root user
RUN addgroup -S app && adduser app -S -G app
RUN chown app /home/app

USER app

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

WORKDIR /home/app/

COPY index.py .
COPY requirements.txt .
USER root
RUN pip install -r requirements.txt
COPY index.py .
USER app

RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /root/function/
WORKDIR /home/app/function/
COPY function/requirements.txt .
RUN pip install -r requirements.txt
RUN pip install --user -r requirements.txt

WORKDIR /home/app/

WORKDIR /root/
COPY function function
USER root
COPY function function
RUN chown -R app:app ./
USER app

ENV fprocess="python index.py"

Expand Down
26 changes: 20 additions & 6 deletions template/python3-flask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,34 @@ RUN chmod +x /usr/bin/fwatchdog
ARG ADDITIONAL_PACKAGE
RUN apk --no-cache add musl-dev gcc make ${ADDITIONAL_PACKAGE}

WORKDIR /root/
# Add non root user
RUN addgroup -S app && adduser app -S -G app
RUN chown app /home/app

USER app

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

WORKDIR /home/app/

COPY index.py .
COPY requirements.txt .
USER root
RUN pip install -r requirements.txt
COPY index.py .
USER app

RUN mkdir -p function
RUN touch ./function/__init__.py
WORKDIR /root/function/
WORKDIR /home/app/function/
COPY function/requirements.txt .
RUN pip install -r requirements.txt
RUN pip install --user -r requirements.txt

WORKDIR /home/app/

WORKDIR /root/
COPY function function
USER root
COPY function function
RUN chown -R app:app ./
USER app

ENV fprocess="python index.py"

Expand Down
10 changes: 4 additions & 6 deletions template/python3-http-armhf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
FROM openfaas/of-watchdog:0.5.3 as watchdog
FROM armhf/python:3.6-alpine

ARG ADDITIONAL_PACKAGE
# Alternatively use ADD https:// (which will not be cached by Docker builder)
RUN apk --no-cache add curl ${ADDITIONAL_PACKAGE} \
&& echo "Pulling watchdog binary from Github." \
&& curl -sSLf https://github.com/openfaas-incubator/of-watchdog/releases/download/0.4.6/of-watchdog-armhf > /usr/bin/fwatchdog \
&& chmod +x /usr/bin/fwatchdog \
&& apk del curl --no-cache

COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog

# Add non root user
RUN addgroup -S app && adduser app -S -G app
Expand Down