Skip to content

Commit

Permalink
♻️ Add user and use ARG in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ishantiw committed Feb 8, 2024
1 parent 3c051c9 commit 2514f40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG GOLANG_VERSION=1
# Pull golang alpine to build binary
FROM golang:1.21-alpine3.19 as builder
FROM golang:${GOLANG_VERSION}-alpine as builder

RUN apk add --no-cache make

Expand All @@ -10,12 +11,16 @@ COPY . .
RUN make build-app

# Use alpine to run app
FROM alpine:3.19
WORKDIR /app
COPY --from=builder /app/bin/faultdetector .
FROM alpine
RUN adduser -D onchain && \
mkdir /home/onchain/faultdetector && \
chown -R onchain:onchain /home/onchain/
USER onchain
WORKDIR /home/onchain/faultdetector
COPY --from=builder /app/bin/faultdetector ./bin/
COPY --from=builder /app/config.yaml .

EXPOSE 8080

# Run app
CMD [ "./faultdetector" ]
CMD [ "./bin/faultdetector" ]
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ api:
fault_detector:
l1_rpc_endpoint: "https://rpc.notadegen.com/eth"
l2_rpc_endpoint: "https://mainnet.optimism.io/"
start_batch_index: 5874
start_batch_index: -1
l2_output_oracle_contract_address: "0x0000000000000000000000000000000000000000"

0 comments on commit 2514f40

Please sign in to comment.