From 0b1ae35fecabd30e18132de4382bb1cfa0d80c0b Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Mon, 1 Apr 2024 04:18:49 +0800 Subject: [PATCH] build: add docker build --- .dockerignore | 15 +++++++++++++++ .gitignore | 2 ++ Dockerfile | 12 ++++++++++++ Makefile | 11 ++++++++++- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2381aab --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +/* + +!/README.md +!/COPYING +!/Makefile + +!/.editorconfig +!/.clang-format + +!/peru.yaml +!/third_party/ + +!/*.c +!/*.h +!/*.rc diff --git a/.gitignore b/.gitignore index 406fb17..d8c7fcc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ compile_commands.json .peru/ +dist/ + ### C ### # Prerequisites *.d diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9d1f3ac --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:latest AS xbuild + +RUN apk add --no-cache make mingw-w64-gcc + +WORKDIR /build +COPY . . + +ARG VERSION +RUN make VERSION="${VERSION}" + +FROM scratch +COPY --from=xbuild /build/even.sys /build/even.pdb / diff --git a/Makefile b/Makefile index dc4a9f1..00d4a5a 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ LDFLAGS += $(KRNLIBS) .SUFFIXES: .sys -.PHONY: clean third_party +.PHONY: clean third_party docker dist all: even.sys @@ -56,3 +56,12 @@ third_party: .peru/lastimports .peru/lastimports: peru.yaml peru sync || : + +dist/: + mkdir -p $@ + +docker: Dockerfile .dockerignore dist/ + docker build -t even --build-arg VERSION="$(VERSION)" . + docker create --name even-build even + docker export even-build | tar x -C dist + docker rm -f even-build