Skip to content

Commit

Permalink
Dockerfile for python, ruby, and C# template should not use ROOT
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Stoekl <ems5311@gmail.com>
  • Loading branch information
ericstoekl committed Sep 15, 2017
1 parent 3a2e814 commit 17cdcee
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
13 changes: 9 additions & 4 deletions template/csharp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ FROM microsoft/dotnet:2.0-sdk as builder

ENV DOTNET_CLI_TELEMETRY_OPTOUT 1

WORKDIR /root/
WORKDIR /root/src
RUN mkdir -p /home/app/src
WORKDIR /home/app/src

COPY . .
RUN dotnet restore ./root.csproj
RUN dotnet publish -c release -o published
Expand All @@ -20,8 +21,12 @@ RUN apt-get update -qy \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /root/
COPY --from=builder /root/src/published .
WORKDIR /home/app/
COPY --from=builder /home/app/src/published .

RUN useradd app
RUN chown -R app ./
USER app

ENV fprocess="dotnet ./root.dll"
EXPOSE 8080
Expand Down
16 changes: 12 additions & 4 deletions template/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,27 @@ RUN apk --no-cache add curl \

WORKDIR /root/

COPY index.py .
COPY requirements.txt .
RUN mkdir -p /home/app/function

COPY index.py /home/app
COPY requirements.txt /home/app

WORKDIR /home/app
RUN pip install -r requirements.txt

COPY function function

RUN touch ./function/__init__.py

WORKDIR /root/function/
WORKDIR /home/app/function/
COPY function/requirements.txt .
RUN pip install -r requirements.txt

WORKDIR /root/
WORKDIR /home/app

RUN adduser app -D
RUN chown -R app ./
USER app

ENV fprocess="python index.py"

Expand Down
11 changes: 9 additions & 2 deletions template/ruby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@ RUN apk --no-cache add curl \
&& apk del curl --no-cache

WORKDIR /root/
RUN mkdir -p /home/app/
WORKDIR /home/app/

COPY Gemfile .
COPY index.rb .
COPY function function
RUN bundle install

WORKDIR /root/function/
WORKDIR /home/app/function/
RUN bundle install

WORKDIR /root/
WORKDIR /home/app/

RUN adduser app -D
RUN chown -R app ./
USER app

ENV fprocess="ruby index.rb"
HEALTHCHECK --interval=2s CMD [ -e /tmp/.lock ] || exit 1

Expand Down

0 comments on commit 17cdcee

Please sign in to comment.