Skip to content

Commit

Permalink
Update dockerfiles to use alpine again
Browse files Browse the repository at this point in the history
  • Loading branch information
pchaganti committed Apr 21, 2024
1 parent 5c88691 commit 7828695
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 33 deletions.
37 changes: 11 additions & 26 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
FROM --platform=linux/amd64 python:3 AS build-env
COPY . /app
WORKDIR /app
FROM python:alpine AS build

RUN pip install --no-cache-dir httpx starlette uvicorn
RUN pip install --no-cache-dir starlette uvicorn

FROM gcr.io/distroless/python3-debian12:latest-amd64
FROM python:alpine AS run

RUN adduser -S sampan -G root
USER sampan

COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --chown=sampan:root python /home/sampan/python

COPY --from=build-env /app /app
WORKDIR /app
EXPOSE 8080
CMD ["python/main.py"]
WORKDIR /home/sampan
ENTRYPOINT ["python", "python/main.py"]
18 changes: 11 additions & 7 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@
# under the License.
#

FROM python:3 AS build-env
COPY . /app
WORKDIR /app
FROM python:alpine AS build

RUN pip install --no-cache-dir httpx starlette sse_starlette uvicorn

FROM gcr.io/distroless/python3-debian12
FROM python:alpine AS run

RUN adduser -S sampan -G root
USER sampan

COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --chown=sampan:root python /home/sampan/python
COPY --chown=sampan:root static /home/sampan/static

COPY --from=build-env /app /app
WORKDIR /app
EXPOSE 8080
CMD ["python/main.py"]
WORKDIR /home/sampan
ENTRYPOINT ["python", "python/main.py"]

0 comments on commit 7828695

Please sign in to comment.