forked from buildroot/buildroot
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sergiy Kukunin <[email protected]>
- Loading branch information
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.git | ||
.config | ||
output/ | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
## Build base image | ||
FROM debian:buster AS base | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
g++-multilib \ | ||
cmake \ | ||
git \ | ||
file \ | ||
bc \ | ||
rsync \ | ||
bison \ | ||
flex \ | ||
gettext \ | ||
texinfo \ | ||
wget \ | ||
cpio \ | ||
python \ | ||
unzip \ | ||
mercurial \ | ||
subversion \ | ||
libncurses5-dev \ | ||
libc6-dev-i386 \ | ||
bzr \ | ||
squashfs-tools \ | ||
u-boot-tools \ | ||
vim \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN useradd --user-group --system --create-home --no-log-init buildroot | ||
|
||
## Build buildroot | ||
FROM base AS builder | ||
ARG CONFIG | ||
|
||
RUN mkdir /opt/buildroot && chown buildroot /opt/buildroot | ||
WORKDIR /opt/buildroot | ||
|
||
USER buildroot | ||
|
||
COPY --chown=buildroot:buildroot . /opt/buildroot | ||
|
||
RUN make od_${CONFIG}_defconfig BR2_EXTERNAL=board/opendingux | ||
RUN make source | ||
RUN CONFIG=${CONFIG} ./rebuild.sh | ||
RUN tar xf output/${CONFIG}/images/opendingux-${CONFIG}-toolchain.*.tar.xz | ||
|
||
## Copy assets to the final image | ||
FROM base | ||
ARG CONFIG | ||
|
||
COPY --from=builder /opt/buildroot/${CONFIG}-toolchain /opt/${CONFIG}-toolchain | ||
|
||
WORKDIR /opt/${CONFIG}-toolchain | ||
ENV PATH ${PATH}:/opt/${CONFIG}-toolchain/bin | ||
|
||
RUN ./relocate-sdk.sh | ||
|
||
USER buildroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
DOCKER_TAG_REVISION := $(or $(DOCKER_TAG_REVISION),$(shell git rev-parse HEAD 2> /dev/null || true)) | ||
DOCKER_TAG_DATE := $(or \ | ||
$(DOCKER_TAG_DATE), \ | ||
$(shell (git log -1 --format="%at" 2> /dev/null || true) | xargs -I{} date -d @{} +%Y%m%d)) | ||
|
||
CONFIGS=gcw0 rs90 | ||
CONFIG_IMAGES=$(addsuffix -docker-image, $(CONFIGS)) | ||
|
||
.PHONY: publish-docker-images $(CONFIG_IMAGES) $(addprefix push-, $(CONFIG_IMAGES)) $(addprefix publish-, $(CONFIG_IMAGES)) docker-image push-docker-image | ||
|
||
publish-docker-images: $(addprefix publish-, $(CONFIG_IMAGES)) | ||
|
||
$(CONFIG_IMAGES): %-docker-image: | ||
make docker-image DOCKER_CONFIG=$* | ||
|
||
$(addprefix push-, $(CONFIG_IMAGES)): push-%-docker-image: | ||
make push-docker-image DOCKER_CONFIG=$* | ||
|
||
$(addprefix publish-, $(CONFIG_IMAGES)): publish-%-docker-image: | ||
$(MAKE) $*-docker-image push-$*-docker-image | ||
|
||
docker-image: | ||
test -n "$(DOCKER_CONFIG)" # $$DOCKER_CONFIG | ||
test -n "$(DOCKER_IMAGE)" # $$DOCKER_IMAGE | ||
docker build \ | ||
-t ${DOCKER_IMAGE}:${DOCKER_CONFIG}-${DOCKER_TAG_REVISION} \ | ||
-t ${DOCKER_IMAGE}:${DOCKER_CONFIG}-${DOCKER_TAG_DATE} \ | ||
-t ${DOCKER_IMAGE}:${DOCKER_CONFIG}-latest \ | ||
--build-arg CONFIG=${DOCKER_CONFIG} . | ||
|
||
push-docker-image: | ||
test -n "$(DOCKER_CONFIG)" # $$DOCKER_CONFIG | ||
test -n "$(DOCKER_IMAGE)" # $$DOCKER_IMAGE | ||
docker push ${DOCKER_IMAGE}:${DOCKER_CONFIG}-${DOCKER_TAG_REVISION} | ||
docker push ${DOCKER_IMAGE}:${DOCKER_CONFIG}-${DOCKER_TAG_DATE} | ||
docker push ${DOCKER_IMAGE}:${DOCKER_CONFIG}-latest |