-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathDockerfile-ubuntu
72 lines (55 loc) · 2 KB
/
Dockerfile-ubuntu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM --platform=linux ubuntu:22.04 as base
ARG BUILDARCH
# Change your versions here
ENV GO_VERSION=1.18.3
ENV IGNITE_VERSION=0.22.1
ENV NODE_VERSION=18.x
ENV MOCKGEN_VERSION=1.6.0
ENV PROTOC_VERSION=21.7
FROM base AS platform-amd64
ENV PROTOC_PLATFORM=x86_64
FROM base AS platform-arm64
ENV PROTOC_PLATFORM=aarch_64
FROM platform-${BUILDARCH}
ENV LOCAL=/usr/local
ENV GOROOT=$LOCAL/go
ENV HOME=/root
ENV GOPATH=$HOME/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
RUN mkdir -p $GOPATH/bin
ENV PACKAGES curl gcc jq make unzip
RUN apt-get update
RUN apt-get install -y $PACKAGES
# Install Go
RUN curl -L https://go.dev/dl/go${GO_VERSION}.linux-$BUILDARCH.tar.gz | tar -C $LOCAL -xzf -
# Install Ignite
RUN curl -L https://get.ignite.com/cli@v${IGNITE_VERSION}! | bash
# Install Node
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
RUN apt-get install -y nodejs
# Install Mockgen
RUN go install github.com/golang/mock/mockgen@v${MOCKGEN_VERSION}
# Install ProtoC
RUN mkdir -p /usr/lib/protoc
WORKDIR /usr/lib/protoc
RUN curl -L https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_PLATFORM}.zip -o protoc.zip
RUN unzip -o protoc.zip
RUN rm protoc.zip
RUN ln -s /usr/lib/protoc/bin/protoc ${LOCAL}/bin/protoc
RUN apt-get clean
EXPOSE 1317 4500 5000 26657
WORKDIR /checkers
COPY go.mod /checkers/go.mod
RUN go mod download
RUN rm /checkers/go.mod
# Create the image
# $ docker build -f Dockerfile-ubuntu . -t checkers_i
# To test only 1 command
# $ docker run --rm -it -v $(pwd):/checkers -w /checkers checkers_i go test github.com/b9lab/checkers/x/checkers/keeper
# To build container
# $ docker create --name checkers -i -v $(pwd):/checkers -w /checkers -p 1317:1317 -p 3000:3000 -p 4500:4500 -p 5000:5000 -p 26657:26657 checkers_i
# $ docker start checkers
# To run server on it
# $ docker exec -it checkers ignite chain serve --reset-once
# In other shell, to query it
# $ docker exec -it checkers checkersd query checkers list-stored-game