Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding logic to remove need for makefile with example bash build script #262

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Built with arch: amd64 flavor: lxde image: ubuntu:20.04
# Built with arch: amd64 flavor: lxde image: ${DOCKER_BASE_IMAGE}
#
################################################################################
# base system
################################################################################

FROM ubuntu:20.04 as system
ARG DOCKER_BASE_IMAGE
FROM ${DOCKER_BASE_IMAGE} as system



Expand Down Expand Up @@ -82,7 +82,7 @@ RUN apt-get update \
################################################################################
# builder
################################################################################
FROM ubuntu:20.04 as builder
FROM ${DOCKER_BASE_IMAGE} as builder


RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
################################################################################

# qemu helper for arm build
FROM ubuntu:20.04 as amd64
ARG DOCKER_BASE_IMAGE

FROM ${DOCKER_BASE_IMAGE} as amd64
RUN apt update && apt install -y qemu-user-static
FROM arm64v8/ubuntu:20.04 as system
FROM arm64v8/${DOCKER_BASE_IMAGE} as system
COPY --from=amd64 /usr/bin/qemu-aarch64-static /usr/bin/


Expand Down Expand Up @@ -79,7 +81,7 @@ RUN apt-get update \
################################################################################
# builder
################################################################################
FROM ubuntu:20.04 as builder
FROM ${DOCKER_BASE_IMAGE} as builder


RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Built with arch: armhf flavor: lxde image: ubuntu:18.04
# Built with arch: armhf flavor: lxde image: ${DOCKER_BASE_IMAGE}
#
################################################################################
# base system
################################################################################

ARG DOCKER_BASE_IMAGE

# qemu helper for arm build
FROM ubuntu:18.04 as amd64
FROM ${DOCKER_BASE_IMAGE} as amd64
RUN apt update && apt install -y qemu-user-static
FROM arm32v7/ubuntu:18.04 as system
FROM arm32v7/${DOCKER_BASE_IMAGE} as system
COPY --from=amd64 /usr/bin/qemu-arm-static /usr/bin/


Expand Down Expand Up @@ -75,7 +77,7 @@ RUN apt-get update \
################################################################################
# builder
################################################################################
FROM ubuntu:18.04 as builder
FROM ${DOCKER_BASE_IMAGE} as builder


RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list;
Expand Down
26 changes: 26 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

#Ensure nothing happens outside the directory this script is ran from
cd "$(dirname "$0")"
SCRIPT_DIRECTORY=$(pwd)

ARCHITECTURE=""
case $(uname -m) in
i386) ARCHITECTURE="386" ;;
i686) ARCHITECTURE="386" ;;
x86_64) ARCHITECTURE="amd64" ;;
arm) dpkg --print-ARCHITECTURE | grep -q "arm64" && ARCHITECTURE="arm64" || ARCHITECTURE="arm" ;;
esac

echo "[INFO] Processor Architecture Detected as $ARCHITECTURE"

DOCKER_BASE_IMAGE="ubuntu:18.04"
DOCKER_FINAL_IMAGE_TAG="dorowu/ubuntu-desktop-lxde-vnc:bionic"

# Comment or Uncomment as needed to build the appropriate final image
# DOCKER_BASE_IMAGE="ubuntu:20.04"
# DOCKER_FINAL_IMAGE_TAG="dorowu/ubuntu-desktop-lxde-vnc:latest"

docker build -t "$DOCKER_FINAL_IMAGE_TAG" -f "Dockerfile.$ARCHITECTURE" \
--build-arg DOCKER_BASE_IMAGE="$DOCKER_BASE_IMAGE" \
$SCRIPT_DIRECTORY