Skip to content

Commit

Permalink
Using a prebuilt devcontainer image
Browse files Browse the repository at this point in the history
Customized the devcontainer
  • Loading branch information
Aragas committed Apr 24, 2024
1 parent c4ae7f1 commit c80b8a9
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 5 deletions.
29 changes: 27 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
# [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

34 changes: 31 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,56 @@
{
"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": [
"ms-vscode.powershell",
"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"
}
}
}
}
}
31 changes: 31 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c80b8a9

Please sign in to comment.