Skip to content

Commit

Permalink
github: docker ci experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
mofosyne committed May 29, 2024
1 parent 3c484b1 commit a37e72b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .devops/ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

###############################################################################
FROM alpine as build

Expand All @@ -8,7 +7,9 @@ RUN apk update && \
WORKDIR /build
COPY . .

RUN make
RUN make cosmocc

RUN make -j $(nproc)

###############################################################################
FROM alpine as package
Expand Down Expand Up @@ -45,3 +46,5 @@ CMD ["--cli", "-p", "hello world the gruff man said"]
# docker build -f .devops/ci.Dockerfile -t llamafile_ci .
# docker create --name llamafile_ci_container llamafile_ci
# docker cp llamafile_ci_container:/usr/src/app/llamafile test.llamafile


33 changes: 33 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: docker-ci
on:
push:
branches: [ master, main, fix ]
pull_request:
branches: [ master, main, fix ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker image
run: |
docker build -f .devops/ci.Dockerfile -t llamafile_ci .
- name: Run Docker container
run: |
docker run llamafile_ci
9 changes: 7 additions & 2 deletions build/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ PREFIX = /usr/local
COSMOCC = .cosmocc/3.3.8
TOOLCHAIN = $(COSMOCC)/bin/cosmo

ARCH := $(shell uname -m)

# Use APE loader to improve portability in container enviroments
APE_LOADER := $(COSMOCC)/bin/ape-$(ARCH).elf

AR = $(TOOLCHAIN)ar
CC = $(TOOLCHAIN)cc
CXX = $(TOOLCHAIN)c++
ZIPOBJ = $(COSMOCC)/bin/zipobj
MKDEPS = $(COSMOCC)/bin/mkdeps
ZIPOBJ = $(APE_LOADER) $(COSMOCC)/bin/zipobj
MKDEPS = $(APE_LOADER) $(COSMOCC)/bin/mkdeps
INSTALL = install

ARFLAGS = rcsD
Expand Down

0 comments on commit a37e72b

Please sign in to comment.