Skip to content

Commit

Permalink
feat: avoid permission issues in proto file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed Oct 30, 2023
1 parent e2ff6c2 commit 455a04b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ proto-lint:

proto-setup:
@echo "🤖 Setting up protobuf environment..."
@docker build --rm --tag kyve-proto:latest --file proto/Dockerfile .
@docker build --rm --tag kyve-proto:latest --file proto/Dockerfile \
--build-arg USER_ID=$$(id -u) --build-arg USER_GID=$$(id -g) .
@echo "✅ Setup protobuf environment!"

###############################################################################
Expand Down
16 changes: 16 additions & 0 deletions proto/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,19 @@ RUN git clone https://github.com/cosmos/gogoproto.git; \
RUN npm install -g swagger-combine

COPY --from=BUILDER /usr/local/bin /usr/local/bin

# Inject user id and group id to avoid permission issues
ARG USER_ID=1000
ARG USER_GID=1000

# Create user and group if they don't exist
RUN if ! getent group $USER_GID; then \
addgroup -g $USER_GID mygroup; \
fi

RUN if ! getent passwd $USER_ID; then \
adduser -D -u $USER_ID -G mygroup myuser; \
fi

# Change to user
USER $USER_ID

0 comments on commit 455a04b

Please sign in to comment.