Skip to content

Commit

Permalink
New Temp
Browse files Browse the repository at this point in the history
  • Loading branch information
gvatsal60 committed Nov 20, 2024
1 parent 9b0e7c7 commit 5b4ce0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # Grant write permissions to modify repository contents
steps:
- uses: actions/checkout@v4
- name: Build
Expand Down
13 changes: 10 additions & 3 deletions Makefiles/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ DOCKER_HOST = docker
# Specifies the context directory used for building the Docker image.
DOCKER_BUILD_CONTEXT = .

# Fallback to default UID and GID if the current environment doesn't have it
DOCKER_UID ?= $(shell id -u || echo 1001) # default to 1001 if id -u fails
DOCKER_GID ?= $(shell id -g || echo 1001) # default to 1001 if id -g fails
# Check if $USER is set, if not, use "whoami" as fallback to get the username
USER_ENV ?= $(or $(USER), $(shell whoami))

# Use the USER_ENV variable to get the UID and GID
DOCKER_UID ?= $(shell id -u $(USER_ENV)) # Get UID based on the username
DOCKER_GID ?= $(shell id -g $(USER_ENV)) # Get GID based on the username

# Alternatively, fallback to system's current UID and GID if USER_ENV is not set
DOCKER_UID ?= $(shell id -u) # Fallback to current user's UID if $USER_ENV fails
DOCKER_GID ?= $(shell id -g) # Fallback to current user's GID if $USER_ENV fails

# Arguments to pass to the Docker command for setting user and mounting volumes.
DOCKER_USER_ARG ?= --user $(DOCKER_UID):$(DOCKER_GID)
Expand Down

0 comments on commit 5b4ce0e

Please sign in to comment.