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

fix(Dockerfile): setup gnupg correctly for nobody #3167

Merged
merged 4 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ RUN if [ "${TARGETARCH}" != "amd64" ]; then apt-get update && apt-get install -y

# Install GnuPG(and import private key) if secret file exists
RUN --mount=type=secret,id=sse_pgp_pkey if [ -f /run/secrets/sse_pgp_pkey ]; then \
apt-get update && apt-get install -y gnupg && gpg --import /run/secrets/sse_pgp_pkey; fi;
apt-get update && apt-get install -y gnupg && gpg --import /run/secrets/sse_pgp_pkey; \
mv /root/.gnupg /app/; \
chown -R nobody /app/.gnupg ; fi;


# Copy the python venv from step 2
Expand Down
4 changes: 3 additions & 1 deletion api/sse/sse_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from sse import tasks
from sse.dataclasses import SSEAccessLogs

GNUPG_HOME = "/app/.gnupg"


def _sse_enabled(get_project_from_first_arg=lambda obj: obj.project):
"""
Expand Down Expand Up @@ -52,7 +54,7 @@ def send_environment_update_message_for_environment(environment):


def stream_access_logs() -> Generator[SSEAccessLogs, None, None]:
gpg = gnupg.GPG()
gpg = gnupg.GPG(gnupghome=GNUPG_HOME)
bucket = boto3.resource("s3").Bucket(settings.AWS_SSE_LOGS_BUCKET_NAME)

for log_file in bucket.objects.all():
Expand Down