Skip to content

Commit 065647c

Browse files
committed
init new docker dev env
1 parent 7e6527d commit 065647c

File tree

3 files changed

+53
-23
lines changed

3 files changed

+53
-23
lines changed

DOCKER.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Docker
22

3-
Run these commands to setup the dev env, which is a copy of the local repo as-is in a volume and a container attached to that volume:
4-
5-
1. `docker build --tag mfbtech-react-async-renderer-dev-env .`
6-
1. `docker run --name mfbtech-react-async-renderer-dev-env -td mfbtech-react-async-renderer-dev-env`
7-
8-
Now attach to the container using vscode and the remote explorer extension.
9-
10-
>
11-
> Deleting the container will delete the volume as well, so make sure you have all of your work pushed before deleting the container.
12-
>
3+
1. Generate an SSH key and add it to GitHub.
4+
1. Clone the repository.
5+
1. Run `eval "$(ssh-agent)"`.
6+
1. Run `ssh-add`.
7+
1. Run `docker build --ssh default --pull -t mfb-async-renderer-dev-env .`.
8+
1. Run `docker create --mount type=bind,src=${HOME}/.ssh,target=/home/vscode/.ssh --name mfb-async-renderer-dev-env-active -h mfb-async-renderer-dev-env -it mfb-async-renderer-dev-env`.
9+
1. Install the "Remote Development" extension pack in VS Code.
10+
1. Navigate to Remote Explorer in the VSCode sidebar.
11+
1. Select Containers from the drop down at the top.
12+
1. Attach to the align-dev-env container.
13+
1. Click Open Folder and open the align-ts folder.

Dockerfile

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
1-
FROM node:16-bullseye AS base-with-deps
2-
1+
FROM debian:bullseye
32
ARG USERNAME=vscode
4-
5-
# setup the vscode user for the developer
6-
RUN groupadd -r $USERNAME \
7-
&& useradd --no-log-init -rm -d /home/$USERNAME -s /bin/bash -g $USERNAME $USERNAME
8-
USER $USERNAME
3+
RUN apt-get update
4+
RUN apt-get -y install git fzf ripgrep curl python3 ssh sudo locales gnupg lsb-release libnss3-tools gstreamer1.0-gl gstreamer1.0-plugins-ugly
5+
# set the locale
6+
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
7+
locale-gen
8+
ENV LANG en_US.UTF-8
9+
ENV LANGUAGE en_US:en
10+
ENV LC_ALL en_US.UTF-8
11+
# configure terminal
12+
ENV TERM="xterm-256color"
13+
ADD https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash .git-completion.bash
14+
ADD https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh .git-prompt.sh
15+
COPY docker/bashrc .bashrc
16+
# setup the user for the developer
17+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
18+
RUN useradd -ms /bin/bash -u 1002 -G sudo $USERNAME
19+
RUN chown -R $USERNAME /home/$USERNAME
920
WORKDIR /home/$USERNAME
10-
11-
# copy local repo into a volume
12-
FROM base-with-deps AS mfbtech-react-async-renderer-dev-env
13-
RUN mkdir /home/$USERNAME/git
14-
COPY --chown=$USERNAME:$USERNAME . /home/$USERNAME/git
15-
VOLUME /home/$USERNAME/git
21+
USER $USERNAME
22+
# setup ssh
23+
RUN mkdir -p -m 0700 ~/.ssh
24+
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts
25+
SHELL ["/bin/bash", "--login", "-c"]
26+
# install nvm with a specified version of node
27+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
28+
&& . ~/.nvm/nvm.sh \
29+
&& nvm install --lts=gallium
30+
# clone repo
31+
RUN --mount=type=ssh,uid=1002 git clone [email protected]:MFB-Technologies-Inc/react-async-renderer /home/$USERNAME/workspace/react-async-renderer
32+
# set working dir
33+
WORKDIR /home/$USERNAME/workspace/react-async-renderer
34+
VOLUME /home/$USERNAME/workspace/react-async-renderer

docker/bashrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## commands relative to root of current git repository
2+
3+
# navigate to root of repository
4+
alias cdg='cd "$(git rev-parse --show-cdup)"'
5+
6+
# list files at root of repository
7+
alias lsg='ls "$(git rev-parse --show-cdup)"'
8+
9+
# git tab completion
10+
source ~/.git-completion.bash

0 commit comments

Comments
 (0)