1# NOTE: Using 1.13 as a base to build the RISCV compiler, the resulting version is based on go1.6.
2FROM golang:1.13
3
4# Clone and complie a riscv compatible version of the go compiler.
5RUN git clone https://review.gerrithub.io/riscv/riscv-go /riscv-go
6# riscvdev branch HEAD as of 2019-06-29.
7RUN cd /riscv-go && git checkout 04885fddd096d09d4450726064d06dd107e374bf
8ENV PATH=/riscv-go/misc/riscv:/riscv-go/bin:$PATH
9RUN cd /riscv-go/src && GOROOT_BOOTSTRAP=$(go env GOROOT) ./make.bash
10ENV GOROOT=/riscv-go
11
12# Set the base env.
13ENV GOOS=linux GOARCH=riscv CGO_ENABLED=0 GOFLAGS='-v -ldflags=-s -ldflags=-w'
14
15# Pre compile the stdlib.
16RUN go build -a std
17
18# Add the code to the image.
19WORKDIR pty
20ADD . .
21
22# Build the lib.
23RUN go build
24