Skip to content

Commit

Permalink
docker: add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
attie-argentum committed Nov 2, 2020
1 parent 7c4cb21 commit 15c5fdf
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM alpine:latest

RUN apk add bash jq alpine-sdk libusb-dev python3-dev py3-pip \
&& pip3 install --upgrade pip

COPY setup-toolchain.sh /opt/
RUN /opt/setup-toolchain.sh

COPY setup-glasgow.sh /opt/
RUN /opt/setup-glasgow.sh

ENTRYPOINT [ "glasgow" ]
6 changes: 6 additions & 0 deletions docker/setup-glasgow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -eu

git clone https://github.com/GlasgowEmbedded/glasgow.git /opt/glasgow -b master
cd /opt/glasgow/software

python3 setup.py develop
25 changes: 25 additions & 0 deletions docker/setup-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -eu

read os <<< "linux"
read arch < <( uname -m )

read url < <(
curl -s "https://api.github.com/repos/open-tool-forge/fpga-toolchain/releases/latest" \
| jq -r \
--arg os "${os}" \
--arg arch "${arch}" \
'
.assets[]
| select(.name | contains($os + "_" + $arch))
| select(.name | endswith(".tar.gz"))
| .browser_download_url
'
)

curl -sL "${url}" | gzip -d | tar -xv -C /opt/
ln -sv /opt/fpga-toolchain/bin/* /usr/bin/

pip3 install nmigen

yosys -V
nextpnr-ecp5 -V

0 comments on commit 15c5fdf

Please sign in to comment.