Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ jobs:
continue-on-error: true
strategy:
matrix:
features: ["easy-container-hooks", "direnv", "mcfly", "minio-client"]
baseImage:
- debian:latest
- ubuntu:latest
- alpine:latest
- mcr.microsoft.com/devcontainers/base:ubuntu
steps:
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

- name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'"
run: devcontainer features test -f ${{ matrix.features }} -i ${{ matrix.baseImage }} .
- name: "Generating tests for 'direnv' against '${{ matrix.baseImage }}'"
run: devcontainer features test -f direnv -i ${{ matrix.baseImage }} .

test-global:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fail.txt
60 changes: 3 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,12 @@
# devcontainer features

<table style="width: 100%; border-style: none;">
<tr>
<td style="width: 140px; text-align: center;">
A cool icon would be nice here.
</td>
<td>
<strong>
Devcontainer 'features'<br />
<em>Simple, reusable features curated by @ChristopherMacGown</em>
</strong>
</td>
</tr>
</table>
> **Fork notice:** This is a fork of [ChristopherMacGown/devcontainer-features](https://github.com/ChristopherMacGown/devcontainer-features).
> It retains only the `direnv` feature, which has been updated to support Alpine Linux images in addition to Debian/Ubuntu.

This repository contains a _collection_ of features curated by @ChristopherMacGown.
This repository contains the `direnv` devcontainer feature.

## Collected Features

### mcfly

[mcfly](https://github.com/cantino/mcfly) is a replacement for your default
`ctrl+r` shell history search that uses an intelligent search engine to prioritize
in real-time from your current working directory and recently used commands to
return history suggestions relevant to what you're working on right now.

#### usage
```json
"features": {
"ghcr.io/ChristopherMacGown/devcontainer-features/mcfly:1": {}
}
```

Additional options can be found in the [feature documentation](src/mcfly/README.md).

### direnv

[direnv](https://github.com/direnv/direnv) augments shells to load and unload
Expand All @@ -46,30 +19,3 @@ environment variables based on the current working directory.
}
```
Additional options can be found in the [feature documentation](src/direnv/README.md).


### easy-container-hooks
This is a cross-distribution devcontainer feature that installs static script runners to /usr/local/bin that will execute scripts located in your devcontainer's local hooks directory.

#### usage
```json
"features": {
"ghcr.io/ChristopherMacGown/devcontainer-feautres/easy-container-hooks:1":{}
}
```
Additional options can be found in the [feature documentation](src/easy-container-hooks/README.md).


### minio-client

[minio-client](https://min.io/docs/minio/linux/reference/minio-mc.html) is an AWS S3
compatible client for S3 and Minio.

#### usage
```json
"features": {
"ghcr.io/ChristopherMacGown/devcontainer-features/minio-client:1": {}
}
```

Additional options can be found in the [feature documentation](src/minio-client/README.md).
4 changes: 2 additions & 2 deletions src/direnv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Installs direnv, which augments shells to load an unload environment variables d

```json
"features": {
"ghcr.io/ChristopherMacGown/devcontainer-features/direnv:1": {}
"ghcr.io/brycircle/devcontainer-features/direnv:1": {}
}
```

Expand All @@ -24,4 +24,4 @@ Installs direnv, which augments shells to load an unload environment variables d

---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/ChristopherMacGown/devcontainer-features/blob/main/src/direnv/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/brycircle/devcontainer-features/blob/main/src/direnv/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
66 changes: 29 additions & 37 deletions src/direnv/install.sh
Original file line number Diff line number Diff line change
@@ -1,59 +1,51 @@
#!/bin/bash

# Checks if apt lists exist and generates them if not.
apt_get_update() {
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}

# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" >/dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
#!/bin/sh

set -e

# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive

check_packages apt-transport-https curl ca-certificates tar

echo "Activating package 'direnv'".

RELEASES="https://github.com/direnv/direnv/releases"
LATEST="${RELEASES}/latest"

ARCH=${ARCHITECTURE:-"amd64"}
AUTO_ENABLE=${AUTOENABLE:-true}
VERSION=${VERSION:-"latest"}
INSTALL_PATH=${INSTALLPATH:-"/usr/local/bin/direnv"}
if [ "${VERSION}" = "latest" ]; then
VERSION=$(curl -si "${LATEST}" | awk '/location: /{ n=split($2,t,"/"); print t[n] }' | tr -d "\r\n")

# Install required packages using whichever package manager is available
if command -v apk >/dev/null 2>&1; then
apk add --no-cache bash curl ca-certificates
elif command -v apt-get >/dev/null 2>&1; then
export DEBIAN_FRONTEND=noninteractive
if [ "$(find /var/lib/apt/lists/* 2>/dev/null | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates tar
else
echo "Unsupported package manager: neither apk nor apt-get found"
exit 1
fi

set -x
RELEASES="https://github.com/direnv/direnv/releases"

if [ "${VERSION}" = "latest" ]; then
VERSION=$(curl -si "${RELEASES}/latest" | awk '/location: /{ n=split($2,t,"/"); print t[n] }' | tr -d "\r\n")
fi

RELEASE_FILE="direnv.linux-${ARCH}"
RELEASE_URL="${RELEASES}/download/${VERSION}/${RELEASE_FILE}"

curl -o ${INSTALL_PATH} -fL "${RELEASE_URL}"
chmod +x ${INSTALL_PATH}
echo "Downloading direnv ${VERSION} for ${ARCH}..."
curl -o "${INSTALL_PATH}" -fL "${RELEASE_URL}"
chmod +x "${INSTALL_PATH}"

if [ "${AUTO_ENABLE}" = "true" ]; then
BASHRC="${_REMOTE_USER_HOME}/.bashrc"
ZSHRC="${_REMOTE_USER_HOME}/.zshrc"

echo "Adding mcfly to ${BASHRC} and ${ZSHRC}"
if [ -z "$(grep _direnv_hook ${BASHRC})" ]; then
direnv hook bash >>${BASHRC}
if ! grep -q "_direnv_hook" "${BASHRC}" 2>/dev/null; then
echo "Adding direnv hook to ${BASHRC}"
direnv hook bash >> "${BASHRC}"
fi

if [ -z "$(grep _direnv_hook ${ZSHRC})"]; then
direnv hook zsh >>${ZSHRC}
if command -v zsh >/dev/null 2>&1 && ! grep -q "_direnv_hook" "${ZSHRC}" 2>/dev/null; then
echo "Adding direnv hook to ${ZSHRC}"
direnv hook zsh >> "${ZSHRC}"
fi
fi
29 changes: 0 additions & 29 deletions src/easy-container-hooks/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions src/easy-container-hooks/devcontainer-feature.json

This file was deleted.

37 changes: 0 additions & 37 deletions src/easy-container-hooks/install.sh

This file was deleted.

11 changes: 0 additions & 11 deletions src/easy-container-hooks/run-hook.sh.tmpl

This file was deleted.

28 changes: 0 additions & 28 deletions src/mcfly/README.md

This file was deleted.

Loading