Skip to content

Commit

Permalink
Add edgetx-builder docker image, optimize edgetx-dev container to use…
Browse files Browse the repository at this point in the history
… less layers (#7)

* Add edgetx-builder docker image, optimize edgetx-dev container to use less layers

* Do not update edgetx-dev:latest for now

* fix syntax
  • Loading branch information
jurgelenas authored Nov 5, 2021
1 parent b832d80 commit f7ebcdd
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 96 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,33 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Check out the repo
- name: Check out the repo
uses: actions/checkout@v2
-
name: Set up Docker Buildx

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and Push edgetx-dev

- name: Build and Push edgetx-dev
uses: docker/build-push-action@v2
with:
context: dev/
file: dev/Dockerfile
push: true
tags: |
ghcr.io/edgetx/edgetx-dev:latest
ghcr.io/edgetx/edgetx-dev:2.5
-
name: Build and Push edgetx-commit-tests
tags: ghcr.io/edgetx/edgetx-dev:2.5.1

- name: Build and Push edgetx-builder
uses: docker/build-push-action@v2
with:
context: commit-tests/
file: commit-tests/Dockerfile
context: builder/
file: builder/Dockerfile
push: true
tags: |
ghcr.io/edgetx/edgetx-commit-tests:latest
ghcr.io/edgetx/edgetx-commit-tests:2.5
ghcr.io/edgetx/edgetx-builder:latest
ghcr.io/edgetx/edgetx-builder:2.5.1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: opentx-dev opentx-builder

opentx-dev:
docker build -t opentx-dev ./dev

opentx-builder:
docker build -t opentx-dev ./builder
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,18 @@ root@02157a542d21:/# cd /src

Then you can just do whatever you need to do with your EdgeTX source tree (compile, test, whatever).

### edgetx-commit-tests

The `edgetx-commit-tests` image is meant to be run with specific `FLAVOR`, so you can if the commit tests on Travis would likely pass on github:
```
% docker run -it --rm -v $(pwd):/src -e FLAVOR=COLORLCD ghcr.io/edgetx/edgetx-commit-tests
```

You can however run them all by using (beware, this is going to be a very long run):
```
% docker run -it --rm -v $(pwd):/src -e FLAVOR=ALL ghcr.io/edgetx/edgetx-commit-tests
```
### edgetx-builder

The `edgetx-builder` image is meant to be used in [cloudbuild](https://github.com/EdgeTX/cloudbuild) project. It favours
rootless user by default, other than that it is exactly the same as `edgetx-dev`.

## Docker repositories

The `edgetx-dev` and `edgetx-commit-tests` image are hosted at Docker hub & Github Container Repository for your convenience.
The `edgetx-dev` and `edgetx-builder` image are hosted at Docker hub & Github Container Repository for your convenience.

Pulling from Github Container Repository with this command:

```
% docker pull ghcr.io/edgetx/edgetx-dev
% docker pull ghcr.io/edgetx/edgetx-commit-tests
% docker pull ghcr.io/edgetx/edgetx-builder
```
5 changes: 5 additions & 0 deletions builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ghcr.io/edgetx/edgetx-dev:latest

RUN useradd --create-home --shell /bin/bash rootless
RUN mkdir -p /home/rootless/src
WORKDIR /home/rootless/src
6 changes: 0 additions & 6 deletions commit-tests/Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions commit-tests/Makefile

This file was deleted.

10 changes: 0 additions & 10 deletions commit-tests/tests.sh

This file was deleted.

63 changes: 31 additions & 32 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,47 @@ ARG OS_CODENAME

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq && \
apt-get install --yes \
software-properties-common \
build-essential gpg wget \
libfox-1.6-dev libclang-6.0-dev libsdl1.2-dev

RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${OS_CODENAME} main" | \
tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
apt-get update -qq && apt-get install --yes cmake

RUN add-apt-repository ppa:git-core/ppa --yes && \
apt-get update -qq && \
apt-get install --yes -qq \
git wget zip unzip \
python3-pip

RUN python3 -m pip install \
asciitree jinja2 \
pillow==7.2.0 \
clang==6.0.0
RUN apt-get update && \
apt-get install --yes --no-install-recommends software-properties-common gpg wget && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${OS_CODENAME} main" | \
tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
apt-get update && \
apt-get install --yes --no-install-recommends \
build-essential \
dumb-init \
build-essential \
libfox-1.6-dev libclang-6.0-dev libsdl1.2-dev \
cmake \
git \
zip \
unzip \
python3-pip \
# Install some dependencies required by Qt libs
libxkbcommon-x11-0 gstreamer1.0-plugins-base && \
rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install -U pip setuptools \
&& python3 -m pip install \
asciitree \
jinja2 \
pillow==7.2.0 \
clang==6.0.0 \
aqtinstall

# Qt installation adapted from
# see https://github.com/miurahr/aqtinstall/
# see https://github.com/vslotman/docker-aqtinstall

RUN python3 -m pip install \
aqtinstall

ARG QT_VERSION=5.12.9
# if modules use syntax -m MODULE [MODULE]
ARG QT_MODULES=
ARG QT_HOST=linux
ARG QT_TARGET=desktop
ARG QT_INSTALL_DIR=/opt/qt

# Install some dependencies required by Qt libs
RUN apt-get install --yes -qq \
libxkbcommon-x11-0 gstreamer1.0-plugins-base

RUN aqt install --outputdir ${QT_INSTALL_DIR} ${QT_MODULES} ${QT_VERSION} ${QT_HOST} ${QT_TARGET}
RUN aqt install --outputdir ${QT_INSTALL_DIR} ${QT_MODULEgS} ${QT_VERSION} ${QT_HOST} ${QT_TARGET}

ARG QT_BASE_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/gcc_64

Expand All @@ -71,6 +70,6 @@ ENV PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/:${PATH}

VOLUME ["/src"]

COPY entrypoint.sh /opt
ENV ASAN_OPTIONS="detect_leaks=0"

ENTRYPOINT ["/opt/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
4 changes: 0 additions & 4 deletions dev/Makefile

This file was deleted.

8 changes: 0 additions & 8 deletions dev/entrypoint.sh

This file was deleted.

0 comments on commit f7ebcdd

Please sign in to comment.