This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
74 lines (58 loc) · 2.07 KB
/
Dockerfile
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
73
74
# syntax=docker.io/docker/dockerfile:1.4
FROM ubuntu:22.04 as build-stage
RUN <<EOF
apt update
apt install -y --no-install-recommends \
build-essential=12.9ubuntu3 \
ca-certificates \
g++-riscv64-linux-gnu=4:11.2.0--1ubuntu1 \
wget
EOF
ARG GOVERSION=1.21.1
WORKDIR /opt/build
RUN wget https://go.dev/dl/go${GOVERSION}.linux-$(dpkg --print-architecture).tar.gz && \
tar -C /usr/local -xzf go${GOVERSION}.linux-$(dpkg --print-architecture).tar.gz
ENV GOOS=linux
ENV GOARCH=riscv64
ENV CGO_ENABLED=1
ENV CC=riscv64-linux-gnu-gcc
ENV PATH=/usr/local/go/bin:${PATH}
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY pkg pkg
COPY internal internal
# runtime stage: produces final image that will be executed
FROM --platform=linux/riscv64 riscv64/ubuntu:22.04 as runtime
LABEL io.sunodo.sdk_version=0.2.0
LABEL io.cartesi.rollups.ram_size=128Mi
ARG MACHINE_EMULATOR_TOOLS_VERSION=0.12.0
RUN <<EOF
apt-get update
apt-get install -y --no-install-recommends busybox-static=1:1.30.1-7ubuntu3 ca-certificates=20230311ubuntu0.22.04.1 curl=7.81.0-1ubuntu1.15
curl -fsSL https://github.com/cartesi/machine-emulator-tools/releases/download/v${MACHINE_EMULATOR_TOOLS_VERSION}/machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.tar.gz \
| tar -C / --overwrite -xvzf -
rm -rf /var/lib/apt/lists/*
EOF
ENV PATH="/opt/cartesi/bin:${PATH}"
WORKDIR /var/opt/cartesi-dapp
ENTRYPOINT ["rollup-init"]
CMD ["/var/opt/cartesi-dapp/dapp"]
#
# Example images
#
FROM build-stage as echo-build-stage
COPY examples/echo examples/echo
RUN go build ./examples/echo/
FROM --platform=linux/riscv64 runtime as echo
COPY --from=echo-build-stage /opt/build/echo dapp
FROM build-stage as honeypot-build-stage
COPY examples/honeypot examples/honeypot
RUN go build ./examples/honeypot/
FROM --platform=linux/riscv64 runtime as honeypot
COPY --from=honeypot-build-stage /opt/build/honeypot dapp
FROM build-stage as textbox-build-stage
COPY examples/textbox examples/textbox
RUN go build ./examples/textbox/
FROM --platform=linux/riscv64 runtime as textbox
COPY --from=textbox-build-stage /opt/build/textbox dapp