Skip to content

Commit

Permalink
feat: nonroot dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri-go committed Apr 13, 2023
1 parent bede2b6 commit 6e822f5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile.nonroot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#install packages for build layer
FROM golang:1.19-alpine as builder
RUN apk add --no-cache git gcc make perl jq libc-dev linux-headers

#build binary
WORKDIR /src
COPY . .
RUN go mod download

#install binary
RUN make install

#build main container
FROM alpine:latest

# Add the "injective" non-root user and group
RUN addgroup -S injective && adduser -S -G injective injective

# Install dependencies
RUN apk add --update --no-cache ca-certificates curl

# Copy the peggo binary
COPY --from=builder /go/bin/* /usr/local/bin/

# Set ownership and permissions
RUN chown -R injective:injective /usr/local/bin

# Configure container
USER injective
VOLUME /apps/data
WORKDIR /home/injective/.injectived/peggo

# Default command
CMD peggo orchestrator

0 comments on commit 6e822f5

Please sign in to comment.