3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

docker compose で VisualBasic を動かせる環境を作成してみた

Posted at

docker、VBの素人です、WindowsのPCを持っていないのにVBの勉強の必要が出てきたので、
ググりながら環境を作成しました、ご了承ください。

docker の設定ファイルなど

docker-compose.yml
services:
  vb_sandbox:
    build:
      context: .
      dockerfile: Dockerfile
    # ホストとゲストの work フォルダを同期
    volumes:
      - ./work:/work
    # 接続したときのデフォルトフォルダ
    working_dir: /work
    # コンテナを起動したままにする
    tty: true
FROM ubuntu:22.04

# mono と vbnc コマンドを使うためにインストール
#   参考 https://www.mono-project.com/download/stable/#download-lin
#        https://life-is-command.com/mono-vb-1/
RUN apt update && \
    apt install ca-certificates gnupg -y && \
    gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
    echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \
    apt update && \
    apt install mono-devel -y && \
    apt install mono-vbnc -y
work/hello.vb
Imports System

Module test
    Sub main()
        Console.WriteLine("Hello")
    End Sub
End Module

コンテナ実行

# ホストで実行すると、コンテナが起動
docker compose up -d
# ゲストに入る
docker compose exec vb_sandbox bash

# コンパイル
vbnc hello.vb

# 実行
mono hello.exe 
Hello

スクリーンショット 2024-11-22 19.27.35.png

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?