Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Update Dockerfile and setup-ubuntu script for ubuntu22.04
  • Loading branch information
asukiaaa committed Jul 30, 2023
commit db0baa92e735da8a680ece450baf4b230fae6edf
6 changes: 4 additions & 2 deletions scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ARG UBUNTU_VERSION=18.04
ARG UBUNTU_VERSION=22.04
# Use the official ubuntu:18.04 image as the parent image
FROM ubuntu:${UBUNTU_VERSION}

# Set the working directory to /app
WORKDIR /app

ARG UBUNTU_VERSION
ARG ARCH=amd64

ADD setup-ubuntu.sh /app
Expand All @@ -13,8 +14,9 @@ ADD sources.list /app
# Tell Ubuntu non-interactive install
ARG DEBIAN_FRONTEND=noninteractive

RUN echo ubuntu version ${UBUNTU_VERSION}

RUN ./setup-ubuntu.sh ${ARCH}
RUN bash ./setup-ubuntu.sh ${ARCH} ${UBUNTU_VERSION}

RUN apt-get install -y ca-certificates
RUN update-ca-certificates
34 changes: 13 additions & 21 deletions scripts/docker/setup-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
#!/bin/bash

# Usage:
# ./setup-ubuntu.sh [arm64 | amd64]
if [ "$1" = "" ] || [ "$2" = "" ]; then
echo "Please execute with target device and image.
$0 target_device image

# Warning! This will override your sources.list file!!

arch=amd64

# Copy off old sources.list file
cp /etc/apt/sources.list /etc/apt/sources.list.old
echo "Backed up /etc/apt/sources.list to /etc/apt/sources.list.old"
Usage:
$0 [arm64 | amd64] [ubuntu-version like 22.04]"
exit 1
fi

# Copy over the new file
cp sources.list /etc/apt/sources.list
echo "Overwrote /etc/apt/sources.list with sources.list"
arch=$1
UBUNTU_VERSION=$2

apt-get update

apt-get install wget -y

# Add Public microsoft repo keys to the image
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb

if [ "$1" = "arm64" ]; then
arch="arm64"
fi
wget -q https://packages.microsoft.com/config/ubuntu/${UBUNTU_VERSION}/packages-microsoft-prod.deb -P /tmp
dpkg -i /tmp/packages-microsoft-prod.deb

echo "Setting up for building $arch binaries"

dpkg --add-architecture amd64
dpkg --add-architecture arm64
dpkg --add-architecture $arch

apt-get update

Expand Down Expand Up @@ -72,4 +64,4 @@ if [ "$arch" = "amd64" ]; then
packages+=(libopencv-dev:$arch)
fi

apt-get install -y --no-install-recommends ${packages[@]}
apt-get install -y --no-install-recommends ${packages[@]}