Skip to content

Commit

Permalink
fix(Dockerfile): setup gnupg correctly for nobody (#3167)
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi authored Dec 15, 2023
1 parent 79e67ee commit 4759876
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

3 comments on commit 4759876

@vercel
Copy link

@vercel vercel bot commented on 4759876 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 4759876 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs.bullet-train.io
docs.flagsmith.com
docs-git-main-flagsmith.vercel.app
docs-flagsmith.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 4759876 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.