tauri/.devcontainer
Tillmann e08c4e6888
Change V1 links to V2 site (#11111)
* Change V1 links to V2 site

* update lockfile

---------

Co-authored-by: Lucas Nogueira <118899497+lucasfernog-crabnebula@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@crabnebula.dev>
2024-09-24 08:09:00 -03:00
..
devcontainer.json VS Code: Ubuntu development container via Docker (#4128) 2022-06-05 21:42:36 -03:00
Dockerfile Change V1 links to V2 site (#11111) 2024-09-24 08:09:00 -03:00
README.md build: migrate repo to use pnpm as the package manager (#10607) 2024-08-16 23:04:08 -03:00

VS Code Devcontainer for Tauri

Overview

Please note that most of these instructions are derived from Microsoft's VS Code documentation: Developing inside a Container. Check the official documentation if you encounter problems and submit a PR with any corrections you find for the instructions below.

The development container included in this repository is derived from Microsoft's default Ubuntu development container. Contents of the Ubuntu Docker image can be in the VS Code devcontainer Ubuntu base Dockerfile. The contents of the container used for development can be found in the Dockerfile located in the same directory as this README.

Usage

  1. Ensure you have all Devcontainer Prerequisites
  2. Open the directory containing your tauri-apps/tauri code.
  3. Install the Remote Development extension pack for VS Code. This will be included if you install recommended workspace extensions upon opening this repository.
  4. Ensure Docker is running
  5. Open your workspace in the provided devcontainer: Open this repository in VS Code and run Remote-Containers: Reopen in Container... from the Command Palette (F1).

Devcontainer Prerequisites

Prerequisites are mainly derived from VS Code's instructions for usage of development containers, documented here: Developing inside a Container: Getting Started.

  1. Docker (Docker Desktop recommended)
  2. VS Code
  3. X window host - required if you want to be able to interact with a GUI from your Docker host

A note on filesystem performance

Due to limitations in how Docker shares files between the Docker host and a container, it's also recommended that developers clone Tauri source code into a container volume. This is optional, but highly advised as many filesystem/IO heavy operations (cargo build, pnpm install, etc) will be very slow if they operate on directories shared with a Docker container from the Docker host.

To do this, open your project with VS Code and run Remote-Containers: Clone Repository in Container Volume... from the Command Palette (F1).

Accessing a Tauri application running you the devcontainer

Docker Desktop provides facilities for allowing the development container to connect to a service on the Docker host. So long as you have an X window server running on your Docker host, the devcontainer can connect to it and expose your Tauri GUI via an X window.

Export the DISPLAY variable within the devcontainer terminal you launch your Tauri application from to expose your GUI outside of the devcontainer.

export DISPLAY="host.docker.internal:0"