Skip to content

Commit e2cc266

Browse files
committed
Add shellcheck to validate bash
Help to avoid bugs Signed-off-by: Eric Curtin <eric.curtin@docker.com>
1 parent 3886d0f commit e2cc266

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ jobs:
2525
- name: Run tests with race detection
2626
run: go test -race ./...
2727

28+
- name: validate
29+
run: make validate
30+
2831
- name: model-distribution # TODO: Create a single Makefile for the monorepo
2932
run: make -C ./pkg/distribution/ all

Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,10 @@ ARG LLAMA_SERVER_VARIANT
4040
# Create non-root user
4141
RUN groupadd --system modelrunner && useradd --system --gid modelrunner --create-home --home-dir /home/modelrunner modelrunner
4242

43+
COPY scripts/apt-install.sh apt-install.sh
44+
4345
# Install ca-certificates for HTTPS and vulkan
44-
RUN apt-get update && \
45-
packages="ca-certificates" && \
46-
if [ "${LLAMA_SERVER_VARIANT}" = "generic" ] || [ "${LLAMA_SERVER_VARIANT}" = "cpu" ]; then \
47-
packages="$packages libvulkan1"; \
48-
fi && \
49-
apt-get install -y --no-install-recommends $packages && \
50-
rm -rf /var/lib/apt/lists/*
46+
RUN ./apt-install.sh
5147

5248
WORKDIR /app
5349

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MODELS_PATH := $(shell pwd)/models-store
1010
LLAMA_ARGS ?=
1111

1212
# Main targets
13-
.PHONY: build run clean test docker-build docker-run help
13+
.PHONY: build run clean test docker-build docker-run help validate
1414

1515
# Default target
1616
.DEFAULT_GOAL := help
@@ -34,6 +34,9 @@ clean:
3434
test:
3535
go test -v ./...
3636

37+
validate:
38+
find . -type f -name "*.sh" | xargs shellcheck
39+
3740
# Build Docker image
3841
docker-build:
3942
docker buildx build \

scripts/apt-install.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
main() {
4+
set -eux -o pipefail
5+
6+
apt-get update
7+
local packages=("ca-certificates")
8+
if [ "${LLAMA_SERVER_VARIANT}" = "generic" ] || [ "${LLAMA_SERVER_VARIANT}" = "cpu" ]; then
9+
packages+=("libvulkan1")
10+
fi
11+
12+
apt-get install -y --no-install-recommends "${packages[@]}"
13+
rm -rf /var/lib/apt/lists/*
14+
}
15+
16+
main "$@"
17+

0 commit comments

Comments
 (0)