Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local devcontainer environment #506

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG VARIANT
ARG MICROSOFT_BASE_IMAGE

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

ENV DEBIAN_FRONTEND=noninteractive \
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"
}