Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Add zig devcontainer #1616

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions containers/zig/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/alpine/.devcontainer/base.Dockerfile

# [Choice] Alpine version: 3.16, 3.15, 3.14, 3.13
ARG VARIANT="3.16"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-alpine-${VARIANT}

RUN apk --no-cache add git

ADD https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.3857+10e11b60e.tar.xz /zig.tar.xz
RUN tar -xvf /zig.tar.xz && mv /zig-linux-x86_64-0.10.0-dev.3857+10e11b60e /zig && chown -R vscode /zig
ENV PATH="/zig:${PATH}"

# [Optional] Uncomment this section to install gyro package manager
# ADD https://github.com/mattnite/gyro/releases/download/0.7.0/gyro-0.7.0-linux-x86_64.tar.gz /gyro.tar.gz
# RUN tar -xvf /gyro.tar.gz && mv /gyro-0.7.0-linux-x86_64 /gyro && chown -R vscode /gyro
# ENV PATH="/gyro/bin:${PATH}"

# ** [Optional] Uncomment this section to install additional packages. **
# RUN apk update \
# && apk add --no-cache <your-package-list-here>
21 changes: 21 additions & 0 deletions containers/zig/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/alpine
{
"name": "Zig-Playground-Alpine",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Alpine version: 3.13, 3.14, 3.15, 3.16
"args": {
"VARIANT": "3.16"
}
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"extensions": [
"tiehuis.zig",
"prime31.zig"
]
}
}
}
2 changes: 2 additions & 0 deletions containers/zig/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
.npmignore
31 changes: 31 additions & 0 deletions containers/zig/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Zig (Community)

## Summary

[Zig](https://ziglang.org/) is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software.

| Metadata | Value |
| --------------------------- | --------------------------------------------------- |
| _Contributors_ | [Semyon Radionov](https://github.com/Wobbly-Wibbly) |
| _Categories_ | Community, Languages |
| _Definition Type_ | Dockerfile |
| _Works in Codespaces_ | Yes |
| _Container host OS support_ | Linux, MacOS, Windows |
| _Container OS_ | Alpine |
| _Languages, platforms_ | Zig |

## Using this definition

After container is started open up a terminal and run

```sh
zig init-exe
# or
zig init-lib
```

To build run

```sh
zig build run
```