Skip to content

Commit

Permalink
build: add mounts and excludes for cargo-based builds
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Cressey <[email protected]>
  • Loading branch information
bcressey committed Sep 7, 2019
1 parent 460696d commit d12e208
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.tar.*
/packages/*/*.crate
**/target/
/.cargo
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ RUN --mount=target=/host \
builddep rpmbuild/SPECS/${PACKAGE}.spec

USER builder
RUN rpmbuild -ba --clean rpmbuild/SPECS/${PACKAGE}.spec
RUN --mount=source=.cargo,target=/home/builder/.cargo \
--mount=type=cache,target=/home/builder/.cache,uid=1000,id=${PACKAGE} \
--mount=source=workspaces,target=/home/builder/rpmbuild/BUILD/workspaces \
rpmbuild -ba --clean rpmbuild/SPECS/${PACKAGE}.spec

FROM scratch AS rpm
COPY --from=rpmbuild /home/builder/rpmbuild/RPMS/*/*.rpm /
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ VARS = $(SPECS:.spec=.makevar)
PKGS = $(SPECS:.spec=.makepkg)

OUTPUT ?= $(TOPDIR)/build
OUTVAR := $(shell mkdir -p $(OUTPUT))
CARGO_HOME ?= $(TOPDIR)/.cargo
OUTVAR := $(shell mkdir -p $(OUTPUT) $(CARGO_HOME))

ARCH ?= $(shell uname -m)

Expand Down

0 comments on commit d12e208

Please sign in to comment.