Update docker_build.sh

This commit is contained in:
Timmy Welch 2023-05-05 18:14:51 -07:00
parent 94a9146476
commit 91f6cb2957
No known key found for this signature in database
4 changed files with 14 additions and 7 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
output output
sources sources
sysroot sysroot
.docker_context
# General # General
.DS_Store .DS_Store

View File

@ -6,18 +6,19 @@ LABEL org.opencontainers.image.url="https://github.com/llamasoft/static-builder"
# This is all that's required for the build process. # This is all that's required for the build process.
# Some packages are already installed but are included for completeness. # Some packages are already installed but are included for completeness.
RUN apt-get update \ RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y \ && apt-get install -y \
gcc g++ \ gcc g++ \
make autoconf automake libtool patch \ make autoconf automake libtool patch \
flex bison \ flex bison \
wget \ curl \
tar gzip bzip2 xz-utils tar gzip bzip2 xz-utils
RUN mkdir -p "/build" RUN mkdir -p "/build" && chown 1000:1000 /build
COPY "Makefile" "/build/" COPY "Makefile" "/build/"
COPY "include" "/build/include" COPY "include" "/build/include"
VOLUME "/build" VOLUME "/build"
WORKDIR "/build" WORKDIR "/build"
USER 1000
ENTRYPOINT ["/usr/bin/make", "-w"] ENTRYPOINT ["/usr/bin/make", "-w"]

View File

@ -312,6 +312,7 @@ clean: mostlyclean
ifneq (,$(TARGET)) ifneq (,$(TARGET))
- $(RM) -r "$(OUTPUT)" - $(RM) -r "$(OUTPUT)"
- $(RM) -r "$(SYSROOT)" - $(RM) -r "$(SYSROOT)"
- $(RM) -r "$(MAKEFILE_DIR)/docker_context"
else else
- $(RM) -r "$(OUTPUT_ROOT)" - $(RM) -r "$(OUTPUT_ROOT)"
- $(RM) -r "$(TOOLCHAIN_ROOT)" - $(RM) -r "$(TOOLCHAIN_ROOT)"
@ -332,4 +333,4 @@ endif
$(info $(subst : ,,$(call activate_toolchain))) $(info $(subst : ,,$(call activate_toolchain)))
$(info LDFLAGS='$(LDFLAGS)') $(info LDFLAGS='$(LDFLAGS)')
$(info CFLAGS='$(CFLAGS)') $(info CFLAGS='$(CFLAGS)')
$(info CXXFLAGS='$(CXXFLAGS)') $(info CXXFLAGS='$(CXXFLAGS)')

View File

@ -4,6 +4,10 @@
# Any arguments supported by make are supported here. # Any arguments supported by make are supported here.
# Example: ./docker_build.sh -j TARGET=arm-linux-musleabi all # Example: ./docker_build.sh -j TARGET=arm-linux-musleabi all
set -e set -e
if [ -e .docker_context ]; then
docker build -t static-builder . rm -r .docker_context/*
docker run -it -v "${PWD}/output":"/build/output" --rm static-builder "$@" fi
mkdir -p .docker_context
cp -r Dockerfile Makefile include .docker_context
docker build -t static-builder .docker_context
docker run -it -v "${PWD}/output":"/build/output:Z" -v "${PWD}/sources":"/build/sources:Z" --rm static-builder "$@"