From 7e25a5c943c86ad3b1d1402fa26fc099a4e87c76 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Tue, 5 Dec 2023 11:20:34 +0545 Subject: [PATCH] Change user to root --- .github/workflows/docker-image-push.yml | 3 ++- Dockerfile | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image-push.yml b/.github/workflows/docker-image-push.yml index 21458aa3..509e9c9e 100644 --- a/.github/workflows/docker-image-push.yml +++ b/.github/workflows/docker-image-push.yml @@ -7,6 +7,7 @@ on: branches: - master - develop + - dockerfile/root # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: REGISTRY: ghcr.io @@ -20,7 +21,7 @@ jobs: permissions: contents: read packages: write - # + # steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/Dockerfile b/Dockerfile index a63f41b8..ec83ee68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,11 +26,11 @@ RUN pip install --user --no-cache-dir --upgrade pip \ && pip install --user --no-cache-dir -e . FROM base as runner -WORKDIR /home/appuser +WORKDIR /home/root ENV PIP_NO_CACHE_DIR=1 ENV PYTHONUNBUFFERED=1 -ENV PATH="/home/appuser/.local/bin:$PATH" -ENV PYTHON_LIB="/home/appuser/.local/lib/python$PYTHON_VERSION/site-packages" +ENV PATH="/home/root/.local/bin:$PATH" +ENV PYTHON_LIB="/home/root/.local/lib/python$PYTHON_VERSION/site-packages" RUN apt-get update \ && apt-get -y upgrade \ @@ -39,7 +39,7 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -COPY --from=builder /root/.local /home/appuser/.local +COPY --from=builder /root/.local /home/root/.local COPY README.md . COPY config.txt.sample ./config.txt COPY setup.py . @@ -54,10 +54,10 @@ FROM runner as prod COPY --from=tippecanoe-builder /usr/local/bin/tippecanoe* /usr/local/bin/ COPY --from=tippecanoe-builder /usr/local/bin/tile-join /usr/local/bin/ -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/root --shell /bin/false root \ + && chown -R root:root /home/root -USER appuser +USER root # CMD ["/bin/bash"] CMD ["uvicorn", "API.main:app", "--reload", "--host", "0.0.0.0", "--port", "8000", "--no-use-colors", "--proxy-headers"] \ No newline at end of file