Docker Quickstart Setup

Docker Quickstart Setup

 

1️⃣ Dockerfile (tools/docker/Dockerfile)

# Base image
FROM ubuntu:22.04

# Arguments
ARG DEBIAN_FRONTEND=noninteractive
ARG USERNAME=workshop
ARG USER_UID=1000
ARG USER_GID=1000

ENV PATH="/opt/riscv/bin:${PATH}"
WORKDIR /home/${USERNAME}/work

# Install essential packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git make cmake wget curl \
python3 python3-pip unzip bison flex \
autoconf automake libtool gawk pkg-config \
gdb-multiarch spike sudo vim less locales \
&& rm -rf /var/lib/apt/lists/*

# Create a non-root user
RUN groupadd -g ${USER_GID} ${USERNAME} \
&& useradd -m -u ${USER_UID} -g ${USER_GID} -s /bin/bash ${USERNAME} \
&& echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}

USER ${USERNAME}

# Copy Quickstart script
COPY docker-quickstart.sh /usr/local/bin/docker-quickstart.sh
RUN chmod +x /usr/local/bin/docker-quickstart.sh

# Default command
ENTRYPOINT [ "/usr/local/bin/docker-quickstart.sh" ] CMD [ "bash" ]


2️⃣ Docker Quickstart Script (tools/docker/docker-quickstart.sh)

#!/usr/bin/env bash
set -euo pipefail

echo "=== Docker Quickstart: Setting up RISC-V Workshop ==="

# Install RISC-V toolchain if not present
if ! command -v riscv64-unknown-elf-gcc &>/dev/null; then
echo "Installing RISC-V GNU Toolchain..."
TMPDIR=$(mktemp -d)
git clone --depth 1 https://github.com/riscv-collab/riscv-gnu-toolchain.git "$TMPDIR/riscv-gnu-toolchain"
cd "$TMPDIR/riscv-gnu-toolchain"
./configure --prefix=/opt/riscv --with-arch=rv64gc --with-abi=lp64d
make -j"$(nproc)"
cd -
rm -rf "$TMPDIR"
else
echo "RISC-V toolchain already installed."
fi

# Create workshop directories
WORK_DIR="$HOME/riscv-workshop"
mkdir -p "$WORK_DIR/examples"
mkdir -p "$WORK_DIR/exercises/day01-environment"
mkdir -p "$WORK_DIR/exercises/day02-sim-and-toolchain"

# Add starter example
cat > "$WORK_DIR/examples/hello.c" <<'EOF'
#include <stdio.h>
int main() {
printf("Hello, RISC-V Workshop (Docker)!\n");
return 0;
}
EOF

# Build and run example
mkdir -p "$WORK_DIR/build"
riscv64-unknown-elf-gcc -O2 -march=rv64gc -mabi=lp64d -o "$WORK_DIR/build/hello.elf" "$WORK_DIR/examples/hello.c"

echo "Running example on Spike simulator:"
spike "$WORK_DIR/build/hello.elf"

echo "=== Quickstart Complete! ==="
echo "Workshop ready in $WORK_DIR"
echo "You can now explore exercises under $WORK_DIR/exercises/"
exec bash


3️⃣ How to Build and Run

  1. Build Docker image

docker build -t riscv-workshop:quickstart -f tools/docker/Dockerfile .
  1. Run the container interactively

docker run --rm -it -v "$PWD:/work" riscv-workshop:quickstart
  • The script will automatically:

    • Install the RISC-V toolchain (if missing)

    • Create riscv-workshop folder inside the container

    • Add hello.c example

    • Compile and run it on Spike simulator

    • Start an interactive Bash shell inside the container


✅ Benefits

  • One command setup: Participants don’t touch system dependencies

  • Reproducible environment: Everyone uses the same container

  • Ready to start exercises immediately


If you want, I can also create a combined Quickstart:

Participants can run exactly one command on their host, and it will either use Docker or Ubuntu automatically depending on what’s available.

Do you want me to make that next?

入金伝票

<form action="" method="post"> <label><strong>氏名(漢字)  :</strong><input type="text" name="name1"><br><br></label> <label><strong>会員番号(ID) :</strong><input type="number" name="userID"><br><br></label> <label><strong>相談室(ID)  :</strong><input type="number" name="agent"><br><br></label> <label><strong>ご希望相談    :</strong><input type="number" name="cnset"><br></label> <label><strong>                 相談セット(4回)は "1"を 単独相談は"0"を入力:<br><br></strong></label> <label><strong>                 "1":遺言  "2":認知機(長谷川式) "3":認知機能(MMSE) "4":精神疾患を入力:<br><br></strong></label> <label><strong>入金額           :</strong><input type="number" name="cash1"><br><br></label> <label><strong>年月日    :</strong><input type="date" name="date1"><br></label> <label><strong>        クリックするとカレンダーから選択</strong> <br><br></label>    <input type="submit" value="送信"> </form>

最近10件の入金伝票

 

test=2
name1 =
userID=
agent =
cnset =
cash =
date =
i=1
id=259

< tr>

< tr>

< tr>

< tr>

< tr>

< tr>

< tr>

< tr>

< tr>

< tr>

< tr>

会員 所属 金額 テスト番号 testID MHC_id 日付
11 0 150000 4 4007 57 2020-08-11
10 0 50000 4 4006 56 2020-08-10
9 6 149999 4 4005 35 0000-00-00
12 0 50000 3 3002 26 2020-08-12
7 6 50000 2 2003 25 2020-08-12
3 0 50000 1 1008 2 2020-08-10
2 0 50000 1 1007 1 2020-08-10
2 0 50000 1 1006 1 2020-08-17
11 0 50000 1 1005 67 2020-08-25
11 0 50000 1 1004 66 2020-08-09