-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable local vscode dev container and install node, starship prompt t…
…hrough Dockerfile (#9) * feat: enable local vscode dev container and install through Dockerfile * feat: update workflow build image * Revert "feat: update workflow build image" This reverts commit 911cc3a. * feat: enable workflow auto build for dev image * feat: pure prompt --------- Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
3ecca66
commit a4299fb
Showing
4 changed files
with
80 additions
and
14,674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
paths: | ||
- Dockerfile | ||
|
||
env: | ||
USER: thangbuiq | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ubunchuu-truong-us/devcontainer:latest | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ env.USER }} | ||
password: ${{ secrets.TOKEN_GITHUB }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Use the base image | ||
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04 | ||
|
||
ARG DOCKERUSER=vscode | ||
RUN \ | ||
echo '${DOCKERUSER} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ | ||
mkdir -p /home/${DOCKERUSER}/.local/bin /home/${DOCKERUSER}/.config && \ | ||
chown -R ${DOCKERUSER} /home/${DOCKERUSER}/ | ||
|
||
# Install Node.js 18 | ||
RUN \ | ||
apt-get update && apt-get install --no-install-recommends -y git curl sudo wget vim && \ | ||
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | ||
apt-get update && apt-get install --no-install-recommends -y nodejs && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Install yarn | ||
RUN \ | ||
npm install -g yarn | ||
|
||
USER ${DOCKERUSER} | ||
|
||
# Install starship for non-root user | ||
RUN \ | ||
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --yes -b /home/${DOCKERUSER}/.local/bin && \ | ||
echo 'eval "$(starship init bash && starship preset pure-preset -o ~/.config/starship.toml)"' >> /home/${DOCKERUSER}/.bashrc |
Oops, something went wrong.