Skip to content

Commit

Permalink
adds Dockerfile - tests in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart committed Nov 4, 2024
1 parent 5666fa5 commit ce39ac2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 9 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
on: push
env:
IMAGE_NAME: flovilmart/nvim
jobs:
build:
runs-on: macos-11
docker:
name: Docker build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Install
run: make
- uses: actions/checkout@v4
- name: Set up SSH
uses: MrSquaare/ssh-setup-action@2d028b70b5e397cf8314c6eaea229a6c3e34977a # v3.1.0
with:
host: github.com
private-key: ${{ secrets.SSH_GITHUB_PPK }}
private-key-name: github-ppk
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64,arm'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup vars
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo VERSION=$VERSION >> "$GITHUB_ENV"
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm64/v8
push: false
ssh: default
tags: |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine:edge

RUN apk add neovim curl bash openssh-client git

RUN mkdir -p ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
RUN ln -sf /usr/bin/nvim /usr/bin/vi

WORKDIR /root/src/flovilmart/vimrc

COPY . .

# Adds SSH keys to make sure we can clone submodules
RUN --mount=type=ssh ./install.sh all
RUN sed -i "s#/opt/homebrew/bin/nu#/bin/bash#" ./plugin/after/styling.lua


CMD nu

Check warning on line 17 in Dockerfile

View workflow job for this annotation

GitHub Actions / Docker build

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
11 changes: 7 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ all() {
TMPDIR=$(mktemp -d)
install_brew_deps
install_apk_deps
mkdir -p ${HOME}/.config
ln -sfn $(pwd) ${HOME}/.config/nvim
nvim -c PlugInstall -c "write ${TMPDIR}/PlugInstall.out" -c quitall
cat ${TMPDIR}/PlugInstall.out
Expand All @@ -29,10 +30,12 @@ install_apk_deps() {
}

setup_shell() {
NUSHELL_PATH=$(which nu)
if [ "${NUSHELL_PATH}" != "/usr/bin/nu" ]; then
echo "Setting up NuShell to /usr/bin/nu"
ln -s ${NUSHELL_PATH} /usr/bin/nu
if command -v brew > /dev/null; then
NUSHELL_PATH=$(which nu)
if [ "${NUSHELL_PATH}" != "/usr/bin/nu" ]; then
echo "Setting up NuShell to /usr/bin/nu"
ln -s ${NUSHELL_PATH} /usr/bin/nu
fi
fi
}

Expand Down

0 comments on commit ce39ac2

Please sign in to comment.