diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index afb9cbd..d57dbe8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,2 +1,27 @@ -FROM mcr.microsoft.com/vscode/devcontainers/base:debian -RUN apt-get update && apt-get install -y p7zip-full && rm -rf /var/lib/apt/lists/* \ No newline at end of file +# [Choice] Debian version (use bullseye on local arm64/Apple Silicon): bookworm, bullseye, buster +ARG VARIANT="bookworm" +FROM buildpack-deps:${VARIANT}-curl + +USER root + +# Install 7zip +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get upgrade -y \ + && apt-get -y install --no-install-recommends \ + p7zip-full + +ARG USERNAME=developer +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ + # + # [Optional] Add sudo support. Omit if you don't need to install software after connecting. + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 62669ce..61139c1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,20 +1,37 @@ { "name": "NodeJS & Powershell & 7z", + "dockerFile": "Dockerfile", "build": { - "dockerfile": "Dockerfile" + "cacheFrom": "ghcr.io/BUTR/game-mount-and-blade2:latest" }, "features": { + //"ghcr.io/stuartleeks/dev-container-features/shell-history:0": { + // + //}, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, "ghcr.io/devcontainers/features/node:1": { "version": "18.17.1", "nodeGypDependencies": "true" }, "ghcr.io/devcontainers/features/powershell:1": { - "version": "latest" + "version": "latest" } }, + "overrideFeatureInstallOrder": [ + //"ghcr.io/stuartleeks/dev-container-features/shell-history", + "ghcr.io/devcontainers/features/git", + "ghcr.io/devcontainers/features/node", + "ghcr.io/devcontainers/features/powershell" + ], "mounts": [ + //"source=profile,target=/home/developer,type=volume", + //"target=/home/developer/.vscode-server,type=volume", "source=${localEnv:HOME}${localEnv:USERPROFILE}/AppData/Roaming/Vortex/plugins,target=/vortex-plugins,type=bind,consistency=default" ], + "postAttachCommand": "yarn install", "customizations": { "vscode": { "extensions": [ @@ -22,7 +39,18 @@ "dbaeumer.vscode-eslint", "github.vscode-github-actions", "ms-azuretools.vscode-docker" - ] + ], + "settings": { + "terminal.integrated.defaultProfile.linux": "pwsh", + "terminal.integrated.profiles.linux": { + "path": { + "path": "/usr/local/bin/pwsh" + } + }, + "powershell.powerShellAdditionalExePaths": { + "pwsh": "/usr/local/bin/pwsh" + } + } } } } \ No newline at end of file diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml new file mode 100644 index 0000000..3e0d91c --- /dev/null +++ b/.github/workflows/devcontainer.yml @@ -0,0 +1,31 @@ +name: Dev Container Build and Push Image + +on: + workflow_dispatch: + push: + branches: + - master + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - + name: Checkout + id: checkout + uses: actions/checkout@v4 + - + name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: BUTR + password: ${{ secrets.TOKEN_GPR }} + - + name: Pre-build dev container image + uses: devcontainers/ci@v0.2 + with: + subFolder: .github + imageName: ghcr.io/devcontainer-${{ github.repository }} + cacheFrom: ghcr.io/devcontainer-${{ github.repository }} + push: always \ No newline at end of file