Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making docker user names consistent #5238

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ RUN apt-get update \
RUN mkdir /static

# Create a non-root user, and make it the owner of the static dir created above
RUN useradd --create-home opener \
&& chown -R opener /static
USER opener
RUN useradd --create-home ov_user \
&& chown -R ov_user /static
USER ov_user

# Copy subpackages from additional build-context 'packages'
# hadolint ignore=DL3022
COPY --chown=opener --from=packages openverse-attribution /packages/python/openverse-attribution/
COPY --chown=ov_user --from=packages openverse-attribution /packages/python/openverse-attribution/

# Copy code into the final image
COPY --chown=opener . /api/
COPY --chown=ov_user . /api/

# Collect static assets, these are used by the next stage, `nginx`
RUN env \
Expand Down
6 changes: 3 additions & 3 deletions api/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ recreate:

# Launch a `pgcli` shell in the web container
pgcli db_user_pass="deploy" db_name="openledger": up
env DC_USER="opener" just ../_pgcli web {{ db_user_pass }} {{ db_name }} db
env DC_USER="ov_user" just ../_pgcli web {{ db_user_pass }} {{ db_name }} db

#########################
# Django administration #
Expand All @@ -112,7 +112,7 @@ dj-local *args:
# Run Django administrative commands inside the Docker container
[positional-arguments]
dj *args: wait-up
env DC_USER="{{ env_var_or_default("DC_USER", "opener") }}" just ../exec web python manage.py "$@"
env DC_USER="{{ env_var_or_default("DC_USER", "ov_user") }}" just ../exec web python manage.py "$@"

# Get IPython shell inside the Docker container
ipython:
Expand Down Expand Up @@ -158,7 +158,7 @@ generate-docs doc="media-props" fail_on_diff="true":
# Run API tests inside the Docker container
[positional-arguments]
test *args: wait-up
env DC_USER="opener" just ../exec web pytest "$@"
env DC_USER="ov_user" just ../exec web pytest "$@"

# Run API tests locally
[positional-arguments]
Expand Down
2 changes: 1 addition & 1 deletion env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# DC_USER=opener
# DC_USER=ov_user

# SKIP_DOTENV_FILES_RECREATION=true
8 changes: 4 additions & 4 deletions indexer_worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ RUN apt-get update \
&& mkdir /worker_state

# Create a non-root user
RUN useradd ingestionu \
&& chown ingestionu /worker_state
RUN useradd ov_user \
&& chown ov_user /worker_state

USER ingestionu
USER ov_user

# Copy code into the final image
COPY --chown=ingestionu . /indexer_worker/
COPY --chown=ov_user . /indexer_worker/

# Expose Gunicorn server to indexer worker Falcon app
EXPOSE 8003
Expand Down
8 changes: 4 additions & 4 deletions ingestion_server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ RUN apt-get update \
&& mkdir /worker_state

# Create a non-root user
RUN useradd ingestionu \
&& chown ingestionu /worker_state
RUN useradd ov_user \
&& chown ov_user /worker_state

USER ingestionu
USER ov_user

# Copy code into the final image
COPY --chown=ingestionu . /ingestion_server/
COPY --chown=ov_user . /ingestion_server/

# Exposes
# - 8001: Gunicorn server for `ingestion_server` Falcon app
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set dotenv-load := true
# _ - Private recipes (https://github.com/casey/just#private-recipes)

IS_CI := env_var_or_default("CI", "")
DC_USER := env_var_or_default("DC_USER", "opener")
DC_USER := env_var_or_default("DC_USER", "ov_user")

# Show all available recipes, also recurses inside nested justfiles
@_default:
Expand Down
Loading