You can find the container at https://github.com/orgs/cse130-assignments/packages/container/package/cse130-devcontainer.
See the wiki for instructions on how to update this container.
A repository for a VS Code Development Container for implementing CSE 130 programming assignments. For some general info on making your own devcontainers see here: https://benmatselby.dev/post/vscode-dev-containers/
Make sure VS Code and Docker are installed and running.
The main purpose of a devcontainer is to have a simple way of getting a usable and predictable development environment regardless of the underlying operating system. The devcontainer configuration is part of each CSE130 assignment.
- In VS Code, select
File -> Open Folder
and navigate to the folder containing your cloned CSE130 assignment. Alternatively, you can use VS Code to clone your assignment repo by selectingClone Git Repository
in a new VS Code window. - Click on 'Yes I trust the authors' at the popup (if it appears).
- You should get a popup that says: "Folder contains a Dev Container configuration
file." Click
Reopen in Container
. - Wait while Docker downloads builds the devcontainer. This could take a while, and might benefit from a good internet connection.
- Once the container is built, try opening a terminal on your devcontainer by
selecting
Terminal -> New Terminal
. The prompt will probably read something likevscode ➜ ~ $
.
Some versions of the VSCode extension Remote - Containers have a bug that interrupts automatic installation scripts. Make sure you are using the latest version.
This probably means that your docker container does not have enough memory allocated to build the Haskell dependencies. GHC is known to be a memory hog! You will probably have better luck by increasing the maximum memory Docker is permitted to use by going to Preferences -> Resources and increasing the Memory slider to at least 4GB.
If your machine has <= 8GB in physical memory, you might be able to get by with
less by repeatedly re-running the failed stack install ...
command until all the
packages manage to install. See
this SO post
for inspiration.
Since the devcontainer is an x86_64 image, there are some potential issues getting
it to run on the new Apple M1 CPU. The best advice at the moment is to try installing
Rosetta 2 to emulate the x86_64 architecture when running the devcontainer.
Run this to install Rosetta.
softwareupdate --install-rosetta
Then download and install Docker for Mac.
Next, open the (potentially hidden) directory cs114a-devcontainer-<version>/.devcontainer
and edit Dockerfile
.
Change
FROM haskell:${VARIANT}
to
FROM --platform=linux/amd64 haskell:${VARIANT}
This tells Docker to run the image under emulation (via Rosetta).