Files
carbon-lang/docker
Nico Z 4ea3e1951b Add ubuntu:22.04 docker images (#1618)
Ubuntu 22.04 base image and examples using github, a copy instruction and volumes.

I was using this to run examples on a windows machine since it is more comfortable than switching OS or using the WSL subsystem directly.
If this is something that other people would like to have  I can add other versions of ubuntu and other linux distributions.
2022-11-03 13:12:21 -07:00
..

Docker

ubuntu:22.04

Build and run image

Build

Building the base image is required.

docker build -t carbon-ubuntu2204-base ./ubuntu2204/base

Build image using git repository

docker build -t carbon-ubuntu2004 ./ubuntu2204/github

Build image using copy instruction

docker build -f ./ubuntu2204/Dockerfile -t carbon-ubuntu2004 ..

Run image

docker run carbon-ubuntu2004

Run image using specific file

docker run carbon-ubuntu2004 bazel run //explorer -- ./explorer/testdata/print/format_only.carbon

Using a mounted volume

Run from the repository root for PWD.

cd ..
docker run -w "/carbon-lang" -v "${PWD}:/carbon-lang" "carbon-ubuntu2004-base" bazel run "//explorer" -- "./explorer/testdata/print/format_only.carbon"