Skip to content

Commit

Permalink
🐳 Add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
ishantiw committed Feb 7, 2024
1 parent d20b8e2 commit bd06235
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
go-version: '1.21'
- name: build
run: go build -v ./...
run: make build
- name: golangci-lint
run: make lint
- name: format
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Pull golang alpine to build binary
FROM golang:1.21-alpine3.19 as builder

RUN apk add --no-cache make

WORKDIR /app

# Build binary
COPY . .
RUN make build

# Use alpine to run app
FROM alpine:3.19
WORKDIR /app
COPY --from=builder /app/bin/faultdetector .
COPY --from=builder /app/config.yaml .

EXPOSE 8080

# Run app
CMD [ "./faultdetector" ]
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ PKGS=$(shell go list ./... | grep -v "/vendor/")

.PHONY: test

APP_NAME = faultdetector
GREEN = \033[0;32m
BLUE = \033[0;34m
COLOR_END = \033[0;39m

build:
@echo "$(BLUE)» Building fault detector application binary... $(COLOR_END)"
@CGO_ENABLED=0 go build -a -o bin/$(APP_NAME) ./cmd/
@echo "$(GREEN) Binary successfully built$(COLOR_END)"

test:
@echo "Test packages"
@go test -race -shuffle=on -coverprofile=coverage.out -cover $(PKGS)
Expand Down
Binary file added bin/faultdetector
Binary file not shown.
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: 0
start_batch_index: 5874
l2_output_oracle_contract_address: "0x0000000000000000000000000000000000000000"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/LiskHQ/op-fault-detector

go 1.21.5
go 1.21

require (
github.com/ethereum-optimism/optimism v1.4.2
Expand Down

0 comments on commit bd06235

Please sign in to comment.