-
Notifications
You must be signed in to change notification settings - Fork 47
/
Dockerfile.nonroot
44 lines (31 loc) · 1.13 KB
/
Dockerfile.nonroot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#install packages for build layer
FROM golang:1.22-alpine as builder
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.1.2/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v2.1.2/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN apk add --no-cache git gcc make perl jq libc-dev linux-headers
#Set architecture
RUN apk --print-arch > ./architecture
RUN cp /lib/libwasmvm_muslc.$(cat ./architecture).a /lib/libwasmvm_muslc.a
RUN rm ./architecture
#build binary
WORKDIR /src
COPY . .
RUN go mod download
#install binary
RUN DOCKER=true 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