Skip to content

Commit

Permalink
Change default user back to appuser
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Nov 20, 2023
1 parent 5cb03c1 commit 6e89ffa
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ RUN gdal-config --version | awk -F'[.]' '{print $1"."$2}'
COPY setup.py .
COPY requirements.txt .
COPY README.md .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir GDAL=="$(gdal-config --version)" \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir -e .
RUN pip install --user --no-cache-dir --upgrade pip \
&& pip install --user --no-cache-dir GDAL=="$(gdal-config --version)" \
&& pip install --user --no-cache-dir -r requirements.txt \
&& pip install --user --no-cache-dir -e .

FROM base as runner
WORKDIR /root # Change the working directory to /root
WORKDIR /home/appuser
ENV PIP_NO_CACHE_DIR=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/root/.local/bin:$PATH"
ENV PYTHON_LIB="/root/.local/lib/python$PYTHON_VERSION/site-packages"
ENV PATH="/home/appuser/.local/bin:$PATH"
ENV PYTHON_LIB="/home/appuser/.local/lib/python$PYTHON_VERSION/site-packages"

RUN apt-get update \
&& apt-get -y upgrade \
Expand All @@ -39,6 +39,7 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /root/.local /home/appuser/.local
COPY README.md .
COPY config.txt.sample ./config.txt
COPY setup.py .
Expand All @@ -49,15 +50,15 @@ COPY src/ ./src/
FROM ghcr.io/hotosm/tippecanoe:main as tippecanoe-builder

FROM runner as prod
# USER root # Change the user to root

# Copy tippecanoe binaries from the tippecanoe stage
COPY --from=tippecanoe-builder /usr/local/bin/tippecanoe* /usr/local/bin/
COPY --from=tippecanoe-builder /usr/local/bin/tile-join /usr/local/bin/

# Remove the useradd and chown commands related to appuser
# RUN useradd --system --uid 900 --home-dir /home/appuser --shell /bin/false appuser \
# && chown -R appuser:appuser /home/appuser
RUN useradd --system --uid 900 --home-dir /home/appuser --shell /bin/false appuser \
&& chown -R appuser:appuser /home/appuser

USER appuser

#CMD ["/bin/bash"]
CMD ["uvicorn", "API.main:app", "--reload", "--host", "0.0.0.0", "--port", "8000", "--no-use-colors", "--proxy-headers"]

0 comments on commit 6e89ffa

Please sign in to comment.