Skip to content

Commit

Permalink
Update Dockerfile and docker-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HYwooo committed Oct 25, 2024
1 parent eb408ce commit 6ec9e1c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker
name: Docker-Publish

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
Expand Down
25 changes: 13 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
FROM ubuntu:noble

LABEL org.opencontainers.image.authors="hywooo" \
LABEL org.opencontainers.image.authors="<GITHUB.COM>HYwooo" \
org.opencontainers.image.title="bsv-wsl2" \
org.opencontainers.image.description="Docker image for Bluespec SystemVerilog environment on WSL2,compatible with https://github.com/WangXuan95/BSV_Tutorial_cn ." \
org.opencontainers.image.url="https://github.com/HYwooo/Docker-BSV-WSL2" \
org.opencontainers.image.source="https://github.com/HYwooo/Docker-BSV-WSL2" \
org.opencontainers.image.documentation="https://github.com/HYwooo/Docker-BSV-WSL2/blob/master/README.md" \
org.opencontainers.image.version="1.0" \
org.opencontainers.image.version="1.0.1" \
org.opencontainers.image.licenses="MIT"


RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources \
&& apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates g++ wget iverilog tcl-dev gtkwave nano git
&& apt update -y && apt upgrade -y

RUN apt install -y --no-install-recommends ca-certificates g++ wget iverilog tcl-dev gtkwave nano git

WORKDIR /opt

RUN wget https://github.com/B-Lang-org/bsc/releases/download/2024.07/bsc-2024.07-ubuntu-24.04.tar.gz \
&& tar -xvf bsc-2024.07-ubuntu-24.04.tar.gz -C /opt \
&& mv /opt/bsc-2024.07-ubuntu-24.04 /opt/bsc \
&& rm bsc-2024.07-ubuntu-24.04.tar.gz \
&& cd /usr && mkdir work && cd /usr/work \
&& rm bsc-2024.07-ubuntu-24.04.tar.gz

WORKDIR /

RUN mkdir /data && cd /data \
&& git clone https://github.com/WangXuan95/BSV_Tutorial_cn.git \
&& cp /usr/work/BSV_Tutorial_cn/bsvbuild.sh /opt/bsc/bin/ && chmod +x /opt/bsc/bin/bsvbuild.sh

ENV PATH=/opt/bsc/bin:$PATH LIBRARY_PATH=/opt/bsc/lib:$LIBRARY_PATH
&& cp /data/BSV_Tutorial_cn/bsvbuild.sh /opt/bsc/bin/ && chmod +x /opt/bsc/bin/bsvbuild.sh

ENV DISPLAY=host.docker.internal:0.0 LIBGL_ALWAYS_INDIRECT=1
ENV PATH=/opt/bsc/bin:$PATH

WORKDIR /
ENV DISPLAY=host.docker.internal:0.0 LIBGL_ALWAYS_INDIRECT=1 LIBRARY_PATH=/opt/bsc/lib

ENTRYPOINT ["/bin/bash"]
60 changes: 46 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,62 @@
# Docker-BSV-WSL2
:whale: Docker for the *Bluespec SystemVerilog (BSV) Tutorial(CN Ver.)* from [![Static Badge](https://img.shields.io/badge/WangXuan95-BSV__Tutorial__cn-blue?style=flat-square&logo=github&cacheSeconds=3600)](https://github.com/WangXuan95/BSV_Tutorial_cn).
![Static Badge](https://img.shields.io/badge/Docker-Image-blue?style=for-the-badge&logo=docker&color=blue&cacheSeconds=3600)![GitHub Repo stars](https://img.shields.io/github/stars/HYwooo/Docker-BSV-WSL2?style=for-the-badge&logo=github&cacheSeconds=3600) ![GitHub License](https://img.shields.io/github/license/HYwooo/Docker-BSV-WSL2?style=for-the-badge&logo=card&cacheSeconds=3600)

[![Static Badge](https://img.shields.io/badge/Compatible_with-WangXuan95/BSV__Tutorial__cn-blue?style=for-the-badge&logo=github&cacheSeconds=3600&color)](https://github.com/WangXuan95/BSV_Tutorial_cn)

Docker Image for Bluespec SystemVerilog environment on WSL2, compatible with *WangXuan95/BSV_Tutorial_cn*.

> ❗ For educational purposes only.
![GitHub Repo stars](https://img.shields.io/github/stars/HYwooo/Docker-BSV-WSL2?style=flat-square&logo=github&color=green)

## Usage
### GET the image
#### PULL from Github Packages
## :rocket:Usage
### 1️⃣ GET the image
#### PULL from Github Packages

```bash
docker pull ghcr.io/hywooo/bsv-wsl2
$ docker pull ghcr.io/hywooo/bsv-wsl2
```
#### or BUILD the image
```bash
$ docker build -f Dockerfile -t hywooo/bsv-wsl2:latest .
$ docker build -f Dockerfile -t hywooo/bsv-wsl2 .
```
### 2️⃣ ENTER the container

```bash
$ docker run -it --name="bsv-wsl2" --hostname yourname -v //path/to/wsl2/yourfiles:/path/to/yourfiles hywooo/bsv-wsl2
```
### ENTER the container
### 3️⃣ CHECK whether the environment is correctly set

```bash
$ docker run -it --name="bsv-wsl2" --hostname yourname -v //mnt/d/mybsvfile:/mnt/mybsvfile hywooo/bsv-wsl2:latest
# /data/BSV_Tutorial_cn/src/1.Hello
$ bsvbuild.sh -bs Hello.bsv
# -e ./sim.out > /dev/stdout
# Hello World!
######
$ bsvbuild.sh -vs Hello.bsv
# Hello World!
# mkTb.v:41: $finish(1) called at 5 (1s)
######
$ bsc
# Usage:
# bsc -help ...
# ...
######
$ gtkwave
# GTKWave Analyzer v3.3.116 (w)1999-2023 BSI
# ...
```
## Container structure
> :sparkles: NOTED: With `VcXsrv` installed, you are enabled to interact with `gtkwave` on Windows w/o any VNCs.
### 🎉ENJOY!

## 🗂️Container structure

```bash
# /BSV_Tutorial_cn location
~/usr/work/BSV_Tutorial_cn
/data/BSV_Tutorial_cn
# bsc location (ALREADY IN PATH)
~/opt/bsc/bin/bsc
/opt/bsc/bin/bsc
# bsvbuild.sh location (ALREADY IN PATH)
~/opt/bsc/bin
/opt/bsc/bin/bsvbuild.sh
```
> :sparkles: NOTED: With `VcXsrv` installed, you are enabled to interact with `gtkwave` on Windows w/o any VNCs.

0 comments on commit 6ec9e1c

Please sign in to comment.