build: add docker build

This commit is contained in:
Zephyr Lykos 2024-04-01 04:18:49 +08:00
parent 221ff55200
commit 0b1ae35fec
No known key found for this signature in database
GPG Key ID: D3E9D31E2F77F04D
4 changed files with 39 additions and 1 deletions

15
.dockerignore Normal file
View File

@ -0,0 +1,15 @@
/*
!/README.md
!/COPYING
!/Makefile
!/.editorconfig
!/.clang-format
!/peru.yaml
!/third_party/
!/*.c
!/*.h
!/*.rc

2
.gitignore vendored
View File

@ -1,6 +1,8 @@
compile_commands.json
.peru/
dist/
### C ###
# Prerequisites
*.d

12
Dockerfile Normal file
View File

@ -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 /

View File

@ -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