diff --git a/.github/workflows/packages.yaml b/.github/workflows/packages.yaml index 54f10aa..1b4492b 100644 --- a/.github/workflows/packages.yaml +++ b/.github/workflows/packages.yaml @@ -167,3 +167,56 @@ jobs: run: | docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} + mosh: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + id: prepare + run: | + DOCKER_IMAGE=ghcr.io/mentos1386/mosh + DOCKER_PLATFORMS=linux/amd64,linux/arm64 + VERSION=master + + TAGS="--tag ${DOCKER_IMAGE}:${VERSION} --tag ${DOCKER_IMAGE}:latest" + + echo ::set-output name=docker_image::${DOCKER_IMAGE} + echo ::set-output name=version::${VERSION} + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + --build-arg VERSION=${VERSION} \ + --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ + --build-arg VCS_REF=${GITHUB_SHA::8} \ + --cache-from "type=local,src=/tmp/.buildx-cache" \ + --cache-to "type=local,dest=/tmp/.buildx-cache" \ + ${TAGS} --file ./packages/Dockerfile.mosh . + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-mosh-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-mosh- + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Docker Buildx (build) + run: | + docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} + - name: Login to Github Registry + if: success() && github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + - name: Docker Buildx (push) + if: success() && github.event_name != 'pull_request' + run: | + docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} + - name: Inspect image + if: always() && github.event_name != 'pull_request' + run: | + docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} + diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 3fa7054..445b8b7 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -18,7 +18,7 @@ RUN set -ueox pipefail \ && apt-get -yqq --no-install-recommends --no-install-suggests install \ ca-certificates \ locales \ - mosh \ + perl \ openssh-server \ psmisc \ && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \ @@ -54,6 +54,7 @@ RUN set -ueox pipefail \ COPY --from=ghcr.io/mentos1386/starship:0.47.0 /usr/local/bin/starship /usr/local/bin/starship COPY --from=ghcr.io/mentos1386/kubectl:1.20.0 /usr/local/bin/kubectl /usr/local/bin/kubectl COPY --from=ghcr.io/mentos1386/glow:1.3.0 /usr/local/bin/glow /usr/local/bin/glow +COPY --from=ghcr.io/mentos1386/mosh:master /usr/local/bin/mosh /usr/local/bin/mosh # Golang COPY --from=golang:1.15.6 --chown=${SSH_USER} /usr/local/go /home/${SSH_USER}/.go ENV PATH=/home/${SSH_USER}/.go/bin:$PATH diff --git a/Makefile b/Makefile index 498b39d..2c1e06a 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,10 @@ build-package-kubectl: @docker buildx build --load -t ${REGISTRY}/kubectl:1.20.0 -f packages/Dockerfile.kubectl packages/ build-package-glow: - @docker buildx build --progress plain --load -t ${REGISTRY}/glow:1.3.0 -f packages/Dockerfile.glow packages/ + @docker buildx build --load -t ${REGISTRY}/glow:1.3.0 -f packages/Dockerfile.glow packages/ + +build-package-mosh: + @docker buildx build --load -t ${REGISTRY}/mosh:master -f packages/Dockerfile.mosh packages/ build-packages: package-kubectl package-starship diff --git a/packages/Dockerfile.mosh b/packages/Dockerfile.mosh new file mode 100644 index 0000000..cd7ce6a --- /dev/null +++ b/packages/Dockerfile.mosh @@ -0,0 +1,52 @@ +FROM debian:10.7 as build + +WORKDIR /usr/src/mosh + +SHELL ["/bin/bash", "-c"] + +RUN set -ueox pipefail \ +&& DEBIAN_FRONTEND=noninteractive \ +&& apt-get -yqq update \ +&& apt-get -yqq --no-install-recommends --no-install-suggests install \ + ca-certificates \ + git \ + autotools-dev \ + perl \ + protobuf-compiler \ + libprotobuf-dev \ + dh-autoreconf \ + pkg-config \ + libutempter-dev \ + zlib1g-dev \ + libncurses5-dev \ + libssl-dev \ + locales \ + tmux \ + less \ + bash-completion \ + g++ \ +&& apt-get -yqq clean all \ +&& rm -rf /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* + +ARG VERSION=master + +RUN git clone https://github.com/mobile-shell/mosh.git \ + --branch $VERSION \ + --depth 1 . +RUN ./autogen.sh +RUN ./configure --enable-compile-warnings=error +RUN make +RUN make install + +FROM alpine:3 +LABEL maintainer="Tine Jozelj " +LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace + +RUN apk --no-cache add perl + +COPY --from=build /usr/local/bin/mosh /usr/local/bin/mosh + +ENTRYPOINT /usr/local/bin/mosh + diff --git a/workspace.toml b/workspace.toml index 6178782..87a6bd0 100644 --- a/workspace.toml +++ b/workspace.toml @@ -29,3 +29,7 @@ version = "0.47.0" name = "glow" version = "1.3.0" +[[templates."package-action".vars.jobs]] +name = "mosh" +version = "master" +