diff options
-rw-r--r-- | .github/workflows/main.yml | 32 | ||||
-rw-r--r-- | Dockerfile | 34 | ||||
-rw-r--r-- | Makefile | 55 |
3 files changed, 121 insertions, 0 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b061f01 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,32 @@ +--- +name: Build +on: + push: + branches: [master] + schedule: + - cron: '5 4 * * *' + workflow_dispatch: + +jobs: + push: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: docker/login-action@v1 + env: + GITHUB_USER: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + registry: ghcr.io + username: $GITHUB_USER + password: ${{ secrets.GITHUB_TOKEN }} + + - run: | + make docker-push \ + DOCKER_EXTRA_ARGS="-v ${HOME}/.docker:/root/.docker" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..984dbf7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM alpine:latest + +ARG NEOVIM_VERSION=stable + +WORKDIR /tmp/nvim + +RUN apk --no-cache add \ + autoconf \ + automake \ + bash \ + build-base \ + cargo \ + cmake \ + coreutils \ + curl \ + gettext-tiny-dev \ + git \ + libarchive-tools \ + libtool \ + make \ + npm \ + perl \ + perl-json-xs \ + perl-lwp-protocol-https \ + pkgconf \ + rust \ + unzip + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN git clone --depth 1 --branch ${NEOVIM_VERSION} https://github.com/neovim/neovim && \ + cd neovim && \ + make CMAKE_BUILD_TYPE=Release && \ + make install diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fc21b8c --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +PROJECT = docker-nvim +IMAGE_NAME := ghcr.io/someone-stole-my-name/$(PROJECT) +IMAGE_PLATFORMS := linux/amd64,linux/arm64 + +define DOCKER_DEPS + binfmt-support \ + ca-certificates \ + curl \ + git \ + gnupg \ + jq \ + lsb-release \ + make \ + qemu-user-static \ + wget +endef + +setup-buildx: + curl -fsSL https://download.docker.com/linux/debian/gpg |\ + gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \ + echo "deb [arch=$(shell dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(shell lsb_release -cs) stable" |\ + tee /etc/apt/sources.list.d/docker.list > /dev/null && \ + cat /etc/apt/sources.list.d/docker.list && \ + apt-get update && \ + apt-get -qq -y install \ + docker-ce \ + docker-ce-cli \ + containerd.io + docker run --privileged --rm tonistiigi/binfmt --install all + docker buildx create --name mybuilder + docker buildx use mybuilder + +push: setup-buildx + docker buildx build \ + --build-arg GOVERSION=$(GOVERSION) \ + --platform $(IMAGE_PLATFORMS) \ + -t $(IMAGE_NAME):latest . --push + if git describe --exact-match; then \ + docker buildx build \ + --build-arg GOVERSION=$(GOVERSION) \ + --platform $(IMAGE_PLATFORMS) \ + -t $(IMAGE_NAME):$(shell git describe --tags --abbrev=0) . --push; \ + fi + +export DOCKER_DEPS +docker-%: + docker run \ + --rm \ + --privileged \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v $(shell pwd):/data \ + -w /data $(DOCKER_EXTRA_ARGS) \ + golang:$(GOVERSION) sh -c "\ + apt-get update && \ + apt-get install -y $$DOCKER_DEPS && make $*" |