Skip to content

Commit 05bd259

Browse files
committed
Remove apt repository list and custom scripts from Dockerfiles
1 parent a81c6c7 commit 05bd259

File tree

7 files changed

+51
-30
lines changed

7 files changed

+51
-30
lines changed

services/adgs/.github/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ RUN opentelemetry-bootstrap -a install && layer-cleanup.sh
4545
RUN apt autoremove -y git && layer-cleanup.sh
4646

4747
# Add a default user
48-
RUN useradd -m user
49-
USER user
50-
WORKDIR /home/user
48+
ARG USER=user
49+
RUN useradd -m $USER
50+
USER $USER
51+
WORKDIR /home/$USER
5152

5253
# The CI/CD will replace this tag in debug mode or else remove it
5354
# [DEBUG_MODE_COMMANDS]
5455

55-
# After this, make sure we're still non-root
56-
USER user
56+
# Remove apt repository list and custom scripts
57+
USER root
58+
RUN rm -f /etc/apt/sources.list /usr/local/bin/layer-cleanup.sh /usr/local/bin/restore-apt.sh
59+
USER $USER
5760

5861
ENTRYPOINT [ \
5962
"python", "-m", "uvicorn", "rs_server_adgs.fastapi.adgs_app:app", \

services/cadip/.github/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ RUN opentelemetry-bootstrap -a install && layer-cleanup.sh
4545
RUN apt autoremove -y git && layer-cleanup.sh
4646

4747
# Add a default user
48-
RUN useradd -m user
49-
USER user
50-
WORKDIR /home/user
48+
ARG USER=user
49+
RUN useradd -m $USER
50+
USER $USER
51+
WORKDIR /home/$USER
5152

5253
# The CI/CD will replace this tag in debug mode or else remove it
5354
# [DEBUG_MODE_COMMANDS]
5455

55-
# After this, make sure we're still non-root
56-
USER user
56+
# Remove apt repository list and custom scripts
57+
USER root
58+
RUN rm -f /etc/apt/sources.list /usr/local/bin/layer-cleanup.sh /usr/local/bin/restore-apt.sh
59+
USER $USER
5760

5861
ENTRYPOINT [ \
5962
"python", "-m", "uvicorn", "rs_server_cadip.fastapi.cadip_app:app", \

services/catalog/.github/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,20 @@ RUN opentelemetry-bootstrap -a install && layer-cleanup.sh
4545
RUN apt autoremove -y git && layer-cleanup.sh
4646

4747
# Add a default user
48-
RUN useradd -m user
49-
USER user
50-
WORKDIR /home/user
48+
ARG USER=user
49+
RUN useradd -m $USER
50+
USER $USER
51+
WORKDIR /home/$USER
5152

5253
# The CI/CD will replace this tag in debug mode or else remove it
5354
# [DEBUG_MODE_COMMANDS]
5455

5556
# [DEBUG_MODE_RELOAD_CATALOG]
5657

57-
# After this, make sure we're still non-root
58-
USER user
58+
# Remove apt repository list and custom scripts
59+
USER root
60+
RUN rm -f /etc/apt/sources.list /usr/local/bin/layer-cleanup.sh /usr/local/bin/restore-apt.sh
61+
USER $USER
5962

6063
# See: rs_server_catalog/main.py
6164
# uvicorn.run(

services/frontend/.github/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,18 @@ RUN chmod ugo+x /scripts/entrypoint_frontend.sh
6060
RUN chmod -R ugo+w $(dirname "${RSPY_OPENAPI_FILE}")
6161

6262
# Add a default user
63-
RUN useradd -m user
64-
USER user
65-
WORKDIR /home/user
63+
ARG USER=user
64+
RUN useradd -m $USER
65+
USER $USER
66+
WORKDIR /home/$USER
6667

6768
# The CI/CD will replace this tag in debug mode or else remove it
6869
# [DEBUG_MODE_COMMANDS]
6970

70-
# After this, make sure we're still non-root
71-
USER user
71+
# Remove apt repository list and custom scripts
72+
USER root
73+
RUN rm -f /etc/apt/sources.list /usr/local/bin/layer-cleanup.sh /usr/local/bin/restore-apt.sh
74+
USER $USER
7275

7376
ENTRYPOINT [ "/bin/bash", "-c", "set -x; /scripts/entrypoint_frontend.sh [DEBUG_MODE_RELOAD_FRONTEND]" ]
7477

services/prip/.github/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ RUN opentelemetry-bootstrap -a install && layer-cleanup.sh
4545
RUN apt autoremove -y git && layer-cleanup.sh
4646

4747
# Add a default user
48-
RUN useradd -m user
49-
USER user
50-
WORKDIR /home/user
48+
ARG USER=user
49+
RUN useradd -m $USER
50+
USER $USER
51+
WORKDIR /home/$USER
5152

5253
# The CI/CD will replace this tag in debug mode or else remove it
5354
# [DEBUG_MODE_COMMANDS]
5455

55-
# After this, make sure we're still non-root
56-
USER user
56+
# Remove apt repository list and custom scripts
57+
USER root
58+
RUN rm -f /etc/apt/sources.list /usr/local/bin/layer-cleanup.sh /usr/local/bin/restore-apt.sh
59+
USER $USER
5760

5861
ENTRYPOINT [ \
5962
"python", "-m", "uvicorn", "rs_server_prip.fastapi.prip_app:app", \

services/staging/.github/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,18 @@ COPY --from=builder /usr/local /usr/local
5757
RUN opentelemetry-bootstrap -a install && layer-cleanup.sh
5858

5959
# Add a default user
60-
RUN useradd -m user
61-
USER user
62-
WORKDIR /home/user
60+
ARG USER=user
61+
RUN useradd -m $USER
62+
USER $USER
63+
WORKDIR /home/$USER
6364

6465
# The CI/CD will replace this tag in debug mode or else remove it
6566
# [DEBUG_MODE_COMMANDS]
6667

67-
# After this, make sure we're still non-root
68-
USER user
68+
# Remove apt repository list and custom scripts
69+
USER root
70+
RUN rm -f /etc/apt/sources.list /usr/local/bin/layer-cleanup.sh /usr/local/bin/restore-apt.sh
71+
USER $USER
6972

7073
ENTRYPOINT [ \
7174
"python", "-m", "uvicorn", "rs_server_staging.main:app", \

services/staging/.github/Dockerfile.dask-staging-local

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ RUN apt autoremove -y gcc git && layer-cleanup.sh
5555
# Install dependencies necessary for execution not compilation
5656
RUN restore-apt.sh && apt install -y libexpat1 && layer-cleanup.sh
5757

58+
# Remove apt repository list and custom scripts
59+
RUN rm -f /etc/apt/sources.list /usr/local/bin/layer-cleanup.sh /usr/local/bin/restore-apt.sh
60+
5861
USER $USER
5962

6063
# Set labels based on the Open Containers Initiative (OCI):

0 commit comments

Comments
 (0)