Skip to content

Commit

Permalink
Add local devcontainer environment
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Reichl <thetredev@gmail.com>
  • Loading branch information
thetredev committed Feb 24, 2023
1 parent 798695d commit 0805556
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ARG VARIANT
ARG MICROSOFT_BASE_IMAGE

FROM ${MICROSOFT_BASE_IMAGE} AS base_image
FROM retypeapp/retype:${VARIANT}

ENV DEBIAN_FRONTEND=noninteractive

ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US \
LC_ALL=C

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
less \
vim \
locales \
bash-completion \
openssh-client \
&& \
apt-get clean \
&& \
locale-gen --purge en_US.UTF-8 \
&& \
groupadd -rg 1000 vscode && \
useradd -rms /bin/bash -u 1000 -g vscode vscode && \
chown -R vscode:vscode /usr/bin/retype

USER vscode
WORKDIR /home/vscode

# Copy Microsoft's .bashrc from their devcontainer base image,
# making the terminal look like an official one
COPY --chown=vscode:vscode --from=base_image /home/vscode/.bashrc /home/vscode/.bashrc
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "retype",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "2.4.0-ubuntu-amd64",
"MICROSOFT_BASE_IMAGE": "mcr.microsoft.com/vscode/devcontainers/base:debian-11"
}
},

"mounts": [
"source=${localEnv:HOME}/.bash_history,target=/home/vscode/.bash_history,type=bind,consistency=cached",
"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached",
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
"source=/etc/resolv.conf,target=/etc/resolv.conf,type=bind,consistency=cached"
],

"containerEnv": {
"EDITOR": "vim",
"GIT_EDITOR": "vim"
},

"forwardPorts": [5000],
"remoteUser": "vscode"
}

0 comments on commit 0805556

Please sign in to comment.