diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a74abd42..1362fdeb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,13 +1,17 @@ { "name": "leeway", - "build": { - "context": "..", - "dockerfile": "../.gitpod.Dockerfile" + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + }, + "ghcr.io/devcontainers/features/go:1": { + "version": "1.24.0" + }, + "ghcr.io/devcontainers/features/common-utils:2": {}, + "ghcr.io/devcontainers-contrib/features/shfmt:1": { + "version": "3.10.0" + } }, - "runArgs": [ - "--privileged", - "--security-opt=seccomp=unconfined", - "--network=host" - ], - "containerUser": "root" -} \ No newline at end of file + "postStartCommand": "./.devcontainer/install-leeway.sh" +} diff --git a/.devcontainer/install-leeway.sh b/.devcontainer/install-leeway.sh new file mode 100755 index 00000000..802f8b07 --- /dev/null +++ b/.devcontainer/install-leeway.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# This script downloads and installs the latest version of leeway + +set -euo pipefail + +# Get the latest leeway version from GitHub API +LATEST_LEEWAY_VERSION=$(curl -s https://api.github.com/repos/gitpod-io/leeway/releases/latest | jq -r '.tag_name' | sed 's/^v//') + +# Ensure we got a valid version +if [ -z "$LATEST_LEEWAY_VERSION" ]; then + echo "Error: Could not determine latest leeway version" >&2 + exit 1 +fi + +echo "Installing leeway version: $LATEST_LEEWAY_VERSION" + +# Download the latest leeway release +curl -L -o /tmp/leeway.tar.gz "https://github.com/gitpod-io/leeway/releases/download/v${LATEST_LEEWAY_VERSION}/leeway_Linux_x86_64.tar.gz" + +# Extract the tarball +tar -xzf /tmp/leeway.tar.gz -C /tmp + +# Install leeway to /usr/local/bin +sudo install -m 755 /tmp/leeway /usr/local/bin/ + +# Clean up temporary files +rm /tmp/leeway.tar.gz /tmp/leeway diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile deleted file mode 100644 index 675d3f97..00000000 --- a/.gitpod.Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -FROM ubuntu:jammy - -ADD https://raw.githubusercontent.com/gitpod-io/workspace-images/main/base/install-packages /usr/bin/install-packages -RUN chmod +x /usr/bin/install-packages - -RUN install-packages \ - zip unzip \ - jq \ - curl \ - ca-certificates \ - file \ - git \ - node.js - -ENV GO_VERSION=1.24.0 -RUN echo "TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}" && \ - case "${TARGETPLATFORM:-linux/amd64}" in \ - "linux/arm64") \ - echo "GO_PLATFORM=linux-arm64" > /tmp/go_platform.env \ - ;; \ - *) \ - echo "GO_PLATFORM=linux-amd64" > /tmp/go_platform.env \ - ;; \ - esac - -# Install Go and add it to PATH -RUN . /tmp/go_platform.env && \ - curl -fsSL https://dl.google.com/go/go$GO_VERSION.$GO_PLATFORM.tar.gz | tar -C /usr/local -xzs - -# Set Go environment variables -ENV GOROOT=/usr/local/go -ENV PATH=$GOROOT/bin:$PATH -ENV GOPATH=/root/go -ENV PATH=$GOPATH/bin:$PATH - -# install VS Code Go tools for use with gopls as per https://github.com/golang/vscode-go/blob/master/docs/tools.md -# also https://github.com/golang/vscode-go/blob/27bbf42a1523cadb19fad21e0f9d7c316b625684/src/goTools.ts#L139 -RUN go install -v github.com/uudashr/gopkgs/cmd/gopkgs@v2 \ - && go install -v github.com/ramya-rao-a/go-outline@latest \ - && go install -v github.com/cweill/gotests/gotests@latest \ - && go install -v github.com/fatih/gomodifytags@latest \ - && go install -v github.com/josharian/impl@latest \ - && go install -v github.com/haya14busa/goplay/cmd/goplay@latest \ - && go install -v github.com/go-delve/delve/cmd/dlv@latest \ - && go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest \ - && go install -v golang.org/x/tools/gopls@latest \ - && go install -v honnef.co/go/tools/cmd/staticcheck@latest \ - && rm -rf /root/.cache - -ENV SHFMT_VERSION=3.10.0 -RUN curl -sSL -o /usr/local/bin/shfmt "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" && \ - chmod 755 /usr/local/bin/shfmt diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 140dff50..00000000 --- a/.gitpod.yml +++ /dev/null @@ -1,20 +0,0 @@ - -checkoutLocation: leeway -workspaceLocation: leeway - -image: - file: .gitpod.Dockerfile - -# List the ports you want to expose and what to do when they are served. See https://www.gitpod.io/docs/43_config_ports/ -ports: -- port: 3000 - -# List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/44_config_start_tasks/ -tasks: -- init: | - git config core.hooksPath .githooks; - go generate -v ./... -vscode: - extensions: - - golang.go - - eamodio.gitlens