From 31505ae597bffe2ce13b524e54d7820fc8b2e53b Mon Sep 17 00:00:00 2001 From: Wibbly Date: Sun, 4 Sep 2022 12:07:12 +0200 Subject: [PATCH] Add zig devcontainer --- containers/zig/.devcontainer/Dockerfile | 20 ++++++++++++ .../zig/.devcontainer/devcontainer.json | 21 +++++++++++++ containers/zig/.npmignore | 2 ++ containers/zig/README.md | 31 +++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 containers/zig/.devcontainer/Dockerfile create mode 100644 containers/zig/.devcontainer/devcontainer.json create mode 100644 containers/zig/.npmignore create mode 100644 containers/zig/README.md diff --git a/containers/zig/.devcontainer/Dockerfile b/containers/zig/.devcontainer/Dockerfile new file mode 100644 index 0000000000..586710aca0 --- /dev/null +++ b/containers/zig/.devcontainer/Dockerfile @@ -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 diff --git a/containers/zig/.devcontainer/devcontainer.json b/containers/zig/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..8d71105228 --- /dev/null +++ b/containers/zig/.devcontainer/devcontainer.json @@ -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" + ] + } + } +} \ No newline at end of file diff --git a/containers/zig/.npmignore b/containers/zig/.npmignore new file mode 100644 index 0000000000..be7637b8e5 --- /dev/null +++ b/containers/zig/.npmignore @@ -0,0 +1,2 @@ +README.md +.npmignore diff --git a/containers/zig/README.md b/containers/zig/README.md new file mode 100644 index 0000000000..33541a6c48 --- /dev/null +++ b/containers/zig/README.md @@ -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 +```