diff --git a/.github/workflows/build-and-publish-from-dotfiles.yml b/.github/workflows/build-and-publish-from-dotfiles.yml new file mode 100644 index 0000000..6261b3f --- /dev/null +++ b/.github/workflows/build-and-publish-from-dotfiles.yml @@ -0,0 +1,29 @@ +name: Build Desktop Environment From Dotfiles +on: [workflow_dispatch] +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Check out repository + uses: actions/checkout@v2 + + - name: Sanitise Repository Owner + run: echo ::set-env name=REPOSITORY_OWNER::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + + - name: Build and Push to GitHub Container Registry + uses: whoan/docker-build-with-cache-action@master + with: + build_extra_args: --build-arg=DESKTOP_ENVIRONMENT_USER=${{ env.REPOSITORY_OWNER }} --build-arg=DOTFILES_CACHEBUST=${{ github.sha }} + dockerfile: docker/Dockerfile + image_name: desktop-environment + push_git_tag: true + registry: ghcr.io/${{ env.REPOSITORY_OWNER }} + username: ${{ env.REPOSITORY_OWNER }} + password: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + + - name: Run desktop environment tests + run: ./docker/scripts/test.sh + env: + DESKTOP_ENVIRONMENT_REGISTRY: ghcr.io/${{ env.REPOSITORY_OWNER }} + continue-on-error: true diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index ab52227..fdf7020 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -3,15 +3,11 @@ on: [push] jobs: build: runs-on: ubuntu-latest - steps: - name: Check out repository uses: actions/checkout@v2 - - name: Sanitise Repository Name - run: echo ::set-env name=GITHUB_REPOSITORY::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') - - name: Sanitise Repository Owner run: echo ::set-env name=REPOSITORY_OWNER::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') @@ -22,13 +18,12 @@ jobs: dockerfile: docker/Dockerfile image_name: desktop-environment push_git_tag: true - registry: docker.pkg.github.com/${{ env.GITHUB_REPOSITORY }} + registry: ghcr.io/${{ env.REPOSITORY_OWNER }} username: ${{ env.REPOSITORY_OWNER }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - name: Run desktop environment tests run: ./docker/scripts/test.sh env: - DESKTOP_ENVIRONMENT_REGISTRY: docker.pkg.github.com/${{ env.GITHUB_REPOSITORY }} - DESKTOP_ENVIRONMENT_CONTAINER_TAG: ${{ github.ref }} + DESKTOP_ENVIRONMENT_REGISTRY: ghcr.io/${{ env.REPOSITORY_OWNER }} continue-on-error: true diff --git a/README.md b/README.md index b23fffb..e6834ec 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ☁️ Cloud Desktop Environment -My [daily driver](https://cloud.docker.com/repository/docker/sabrehagen/desktop-environment) on the cloud and on desktop. +My [daily driver](https://github.com/users/sabrehagen/packages/container/package/desktop-environment) on the cloud and on desktop. ![desktop](https://i.imgur.com/cEBbzyu.png) @@ -16,9 +16,9 @@ git clone https://github.com/sabrehagen/desktop-environment ./desktop-environment/docker/scripts/recycle.sh ``` -## Forking +## Running in the Cloud -Set your [user configuration](docker/scripts/environment.sh#L3) and go. +Fork the [github-computer/github-computer](https://github.com/github-computer/github-computer) repository and this desktop environment will be deployed to GitHub's cloud. ## Keybindings @@ -56,4 +56,3 @@ Mod + slash - [x] A computer wholly defined in code. - [x] Only one command required to start from scratch. - diff --git a/docker/Dockerfile b/docker/Dockerfile index 01c5036..1124279 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,6 @@ ARG DESKTOP_ENVIRONMENT_USER ARG DESKTOP_ENVIRONMENT_GITHUB_USER ENV DESKTOP_ENVIRONMENT_HOST_USER_PASSWORD ${DESKTOP_ENVIRONMENT_HOST_USER_PASSWORD:-'$6$7De0aW9hUvGDKZmc$qrylcFmwKAL9iGNG9dvQ/GXCM4gLY.hES/P2d/3ZzRxkVMjD77WeTVSxV1P9XtmE9iAUmDwDTCHiVK.p5Ct1y1:18193:0:99999:7:::'} -ENV DISPLAY :1 ENV EDITOR nano ENV LANG en_US.UTF-8 ENV LANGUAGE $LANG @@ -131,9 +130,6 @@ RUN wget -O alacritty.deb -nv https://github.com/jwilm/alacritty/releases/downlo dpkg -i alacritty.deb && \ rm alacritty.deb -# Install antigen -RUN curl -fsSL git.io/antigen > /usr/local/bin/antigen.zsh - # Install arc RUN wget -O /usr/local/bin/arc -q https://github.com/mholt/archiver/releases/download/v3.1.1/arc_linux_amd64 && \ chmod +x /usr/local/bin/arc @@ -258,7 +254,10 @@ RUN add-apt-repository ppa:kgilmer/speed-ricer && \ sed -i 's/rm -f "$IMAGE"//' /usr/bin/i3lock-fancy && \ wget -q -O /usr/share/i3lock-fancy/lock.png http://png-pixel.com/1x1-00000000.png && \ pip3 install --user i3-resurrect==1.4.2 && \ - pip3 install --force --user i3-workspace-names-daemon + pip3 install --force --user i3-workspace-names-daemon && \ + git clone https://github.com/s-urbaniak/i3-focus-last ~/.config/i3/i3-focus-last && \ + cd ~/.config/i3/i3-focus-last && \ + go install # Install jobber RUN wget -O jobber.deb -q https://github.com/dshearer/jobber/releases/download/v1.4.0/jobber_1.4.0-1_amd64.deb && \ @@ -291,7 +290,8 @@ RUN wget -O musikcube.deb -nv https://github.com/clangen/musikcube/releases/down RUN curl -fsSL https://deb.nodesource.com/setup_12.x | bash - # Install novnc -RUN git clone --depth 1 https://github.com/cloud-computer/noVNC.git /opt/noVNC +RUN git clone --depth 1 https://github.com/cloud-computer/noVNC.git /opt/noVNC && \ + git clone https://github.com/novnc/websockify /opt/noVNC/utils/websockify # Install onedrive client RUN wget -O /usr/local/bin/onedrive -nv https://github.com/sabrehagen/onedrive/raw/master/onedrive && \ @@ -321,7 +321,7 @@ RUN wget -O skype.deb -q https://go.skype.com/skypeforlinux-64.deb && \ rm skype.deb # Install slack -RUN wget -O slack.deb -nv https://downloads.slack-edge.com/linux_releases/slack-desktop-4.1.1-amd64.deb && \ +RUN wget -O slack.deb -nv https://downloads.slack-edge.com/linux_releases/slack-desktop-4.9.1-amd64.deb && \ dpkg -i slack.deb || apt-get install -qq --fix-broken && \ rm slack.deb @@ -336,9 +336,6 @@ RUN wget -O /usr/local/bin/timeago -nv https://raw.githubusercontent.com/sabreha RUN wget -O /usr/local/bin/tormix -nv https://raw.githubusercontent.com/ckardaris/tormix/master/tormix && \ chmod +x /usr/local/bin/tormix -# Install tmux plugin manager -RUN git clone --depth 1 https://github.com/tmux-plugins/tpm $HOME/.tmux/plugins/tpm - # Install tmuxinator RUN gem install tmuxinator -v 1.1.5 @@ -348,9 +345,7 @@ RUN wget -O code.deb -nv https://go.microsoft.com/fwlink/?LinkID=760868 && \ rm code.deb && \ apt-get install -qq libicu[0-9][0-9] libkrb5-3 zlib1g libsecret-1-0 desktop-file-utils x11-utils && \ wget -O /usr/local/bin/shfmt -nv https://github.com/mvdan/sh/releases/download/v2.6.3/shfmt_v2.6.3_linux_amd64 && \ - chmod +x /usr/local/bin/shfmt && \ - git clone https://github.com/Bluedrack28/vscode-wal.git ~/.vscode/extensions/vscode-wal && \ - cd ~/.vscode/extensions/vscode-wal && ./script.sh + chmod +x /usr/local/bin/shfmt # Install warnai RUN apt-get update -qq && \ @@ -386,8 +381,11 @@ RUN yarn global add \ github-email \ http-server \ imgur-uploader-cli \ + localtunnel \ + ngrok \ rebase-editor \ - tldr + tldr && \ + tldr --update # Install zoom conferencing RUN wget -O zoom.deb -nv https://zoom.us/client/latest/zoom_amd64.deb && \ @@ -398,7 +396,7 @@ RUN wget -O zoom.deb -nv https://zoom.us/client/latest/zoom_amd64.deb && \ RUN mkdir -p $HOME/.config/openvpn && \ mknod $HOME/.config/openvpn/tun c 10 200 && \ chmod 600 $HOME/.config/openvpn/tun && \ - wget -O $HOME/.config/openvpn/america.ovpn -nv https://downloads.nordcdn.com/configs/files/ovpn_legacy/servers/us4231.nordvpn.com.tcp443.ovpn && \ + wget -O $HOME/.config/openvpn/america.ovpn -nv https://downloads.nordcdn.com/configs/files/ovpn_legacy/servers/us4672.nordvpn.com.tcp443.ovpn && \ wget -O $HOME/.config/openvpn/sydney.ovpn -nv https://downloads.nordcdn.com/configs/files/ovpn_legacy/servers/au698.nordvpn.com.tcp443.ovpn && \ wget -O $HOME/.config/openvpn/india.ovpn -nv https://downloads.nordcdn.com/configs/files/ovpn_legacy/servers/in82.nordvpn.com.tcp443.ovpn @@ -431,9 +429,12 @@ WORKDIR $HOME ARG DOTFILES_CACHEBUST RUN DOTFILES_CACHEBUST=$DOTFILES_CACHEBUST echo "Building from dotfiles..." -# Clone user dotfiles -RUN vcsh clone https://github.com/$DESKTOP_ENVIRONMENT_GITHUB_USER/dotfiles.git && \ - $HOME/.dotfiles-bootstrap.sh +# Clone user dotfiles or fallback to sabrehagen dotfiles +RUN git ls-remote git@github.com:$DESKTOP_ENVIRONMENT_GITHUB_USER/dotfiles.git && vcsh clone https://github.com/$DESKTOP_ENVIRONMENT_USER/dotfiles.git || \ + vcsh clone https://github.com/sabrehagen/dotfiles.git + +# Bootstrap dotfiles +RUN $HOME/.dotfiles-bootstrap.sh # Record container build information ARG DESKTOP_CONTAINER_GIT_SHA diff --git a/docker/scripts/start.sh b/docker/scripts/start.sh index a9d2232..c67728b 100755 --- a/docker/scripts/start.sh +++ b/docker/scripts/start.sh @@ -17,10 +17,14 @@ docker run \ --device /dev/fuse \ --device /dev/input \ --device /dev/snd \ +<<<<<<< HEAD --device /dev/tty2 \ --device /dev/vsock \ +======= + --device /dev/tty3 \ + --device /dev/video0 \ +>>>>>>> 7fba7a54d51ca7aea35411a174a3b1042aaa6916 --env DESKTOP_ENVIRONMENT_USER \ - --env DISPLAY=:1 \ --group-add audio \ --group-add docker \ --group-add input \ diff --git a/docker/scripts/test.sh b/docker/scripts/test.sh index 42322fe..620cd91 100755 --- a/docker/scripts/test.sh +++ b/docker/scripts/test.sh @@ -16,13 +16,11 @@ docker run \ --name $DESKTOP_ENVIRONMENT_CONTAINER_NAME \ --rm \ --workdir $DESKTOP_ENVIRONMENT_USER_HOME \ - $DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER_IMAGE:$DESKTOP_ENVIRONMENT_CONTAINER_TAG \ + $DESKTOP_ENVIRONMENT_REGISTRY/$DESKTOP_ENVIRONMENT_CONTAINER_IMAGE \ sleep infinity -exit 1 - # Wait until the desktop environment test container is running before proceeding -until docker inspect $DESKTOP_ENVIRONMENT_CONTAINER_NAME | grep Status | grep -m 1 running >/dev/null; do sleep 1; done +timeout 10 $(until docker inspect $DESKTOP_ENVIRONMENT_CONTAINER_NAME | grep Status | grep -m 1 running >/dev/null; do sleep 1; done) # Start the vnc server inside the desktop environment test container $REPO_ROOT/docker/scripts/exec.sh /home/$DESKTOP_ENVIRONMENT_USER/.config/scripts/startup.sh