Add a Dockerfile
Some checks failed
E2E Tests / test-e2e (pull_request) Failing after 1m49s
Integration Tests / test-integration (pull_request) Successful in 2m6s

This commit is contained in:
Prathamesh Musale 2024-03-06 17:26:01 +05:30
parent 034ef545f0
commit 5e9372fd7f
5 changed files with 59 additions and 9 deletions

3
.gitignore vendored
View File

@ -19,3 +19,6 @@
# Go workspace file
go.work
# build
build

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM golang:alpine AS build-env
# Install dependencies
RUN apk add --update git build-base linux-headers
# Set working directory for the build
WORKDIR /go/src/git.vdb.to/cerc-io/laconic2d
# Cache Go modules
COPY go.mod go.sum ./
RUN go mod download
# Add source files
COPY . .
# Make the binary
RUN make build
# Final image
FROM alpine:3.17.0
# Install ca-certificates
RUN apk add --update ca-certificates jq curl
# Copy over binaries from the build-env
COPY --from=build-env /go/src/git.vdb.to/cerc-io/laconic2d/build/laconic2d /usr/bin/laconic2d
WORKDIR /
# Run laconic2d by default
CMD ["laconic2d"]

View File

@ -24,20 +24,33 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=laconic \
BUILD_FLAGS := -ldflags '$(ldflags)'
BUILDDIR ?= $(CURDIR)/build
###########
# Install #
###########
go.sum: go.mod
echo "Ensure dependencies have not been modified ..." >&2
go mod verify
go mod tidy
BUILD_TARGETS := build install
build: BUILD_ARGS=-o $(BUILDDIR)/
build-linux:
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
@echo "--> installing laconic2d"
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./...
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/
all: install
install:
@echo "--> ensure dependencies have not been modified"
@go mod verify
@echo "--> installing laconic2d"
@go install $(BUILD_FLAGS) -mod=readonly ./cmd/laconic2d
init:
./scripts/init.sh
.PHONY: build build-linux install
##################
### Protobuf ###

View File

@ -7,7 +7,7 @@ Install `laconic2d`:
make install
```
Run with a single node:
Run with a single node fixture:
```bash
# start the chain

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker build -t cerc/laconic2d:local ../.. --progress=plain --no-cache