Add initialization script and a Dockerfile #15

Merged
ashwin merged 3 commits from pm-update-init into main 2024-03-07 05:10:42 +00:00
5 changed files with 59 additions and 9 deletions
Showing only changes of commit 5e9372fd7f - Show all commits

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