Add a Dockerfile
This commit is contained in:
parent
034ef545f0
commit
5e9372fd7f
3
.gitignore
vendored
3
.gitignore
vendored
@ -19,3 +19,6 @@
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
|
||||
# build
|
||||
build
|
||||
|
31
Dockerfile
Normal file
31
Dockerfile
Normal 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"]
|
29
Makefile
29
Makefile
@ -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 ###
|
||||
|
@ -7,7 +7,7 @@ Install `laconic2d`:
|
||||
make install
|
||||
```
|
||||
|
||||
Run with a single node:
|
||||
Run with a single node fixture:
|
||||
|
||||
```bash
|
||||
# start the chain
|
||||
|
3
tests/sdk_tests/build-laconicd-container.sh
Executable file
3
tests/sdk_tests/build-laconicd-container.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker build -t cerc/laconic2d:local ../.. --progress=plain --no-cache
|
Loading…
Reference in New Issue
Block a user