Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-treebeard committed Aug 1, 2024
1 parent cfa19a8 commit b85fa53
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .devcontainer/vm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See here for image contents:
# https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
ARG VARIANT="3.11"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

USER vscode
RUN pip3 --disable-pip-version-check --no-cache-dir install -U \
'poetry==1.1.13' \
'pip==22.1.2'
# prevent homebrew from updating or upgrading to save time
ENV HOMEBREW_NO_AUTO_UPDATE=1
ENV HOMEBREW_NO_INSTALL_UPGRADE=1

WORKDIR /tmp
RUN curl \
-Lk \
'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' \
--output vscode_cli.tar.gz
RUN sudo rm /usr/local/bin/code
RUN sudo tar -xf vscode_cli.tar.gz -C /usr/local/bin

ENV TUNNEL_NAME=runpod
ENV VSCODE_CLI_USE_FILE_KEYCHAIN=true

WORKDIR /home/vscode

COPY ./vm/start.sh /etc/start.sh
CMD /etc/start.sh
38 changes: 38 additions & 0 deletions .devcontainer/vm/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "VM Devcontainer",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "3.11",
"INSTALL_NODE": "true",
"NODE_VERSION": "18.7"
}
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"python.pythonPath": "/usr/local/bin/python"
},
"extensions": [
"ms-python.python"
]
}
},
"features": {
"ghcr.io/devcontainers-contrib/features/starship:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {
},
},
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zsh_history,target=/home/vscode/.zsh_history,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshenv,target=/home/vscode/.zshenv,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.config/starship.toml,target=/home/vscode/.config/starship.toml,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.config/gh,target=/home/vscode/.config/gh,type=bind,consistency=cached",
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached",
],
"remoteUser": "vscode"
}
11 changes: 11 additions & 0 deletions .devcontainer/vm/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /usr/bin/env bash

set -e -u -o pipefail -x

[ "$(stat -c %U .)" = "root" ] && sudo chown vscode:vscode /home/vscode

yes | \
code tunnel \
--accept-server-license-terms \
--name ${TUNNEL_NAME} \
--cli-data-dir /home/vscode/.vscode-cli
22 changes: 22 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pytest
on:
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- run: npm install -g @devcontainers/[email protected]
- run: |
set -e -x -u -o pipefail
repo=ghcr.io/treebeardtech/dev-images; tag=latest
docker pull hello-world
docker tag hello-world $repo:$tag
# devcontainer build \
# --workspace-folder . \
# --config .devcontainer/vm/devcontainer.json \
# --image-name $repo:$tag
docker push $repo:$tag

0 comments on commit b85fa53

Please sign in to comment.