diff --git a/.github/workflows/docker_build_push.yml b/.github/workflows/docker_build_push.yml new file mode 100644 index 000000000..836f0a730 --- /dev/null +++ b/.github/workflows/docker_build_push.yml @@ -0,0 +1,54 @@ +name: Push Docker Image + +on: + pull_request: + push: + branches: + - main + +env: + IMAGE_NAME: ${{ github.repository }} + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ vars.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: | + my-docker-hub-namespace/my-docker-hub-repository + ghcr.io/${{ github.repository }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64, linux/arm64 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..bd9928253 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu as builder + +RUN apt-get update > /dev/null && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential libreadline-dev libffi-dev git pkg-config libsdl2-2.0-0 libsdl2-dev python3 parallel ca-certificates > /dev/null && \ + rm -rf /var/lib/apt/lists/* + +COPY ./.git /src/.git +COPY ./lib /src/lib +COPY ./mpy-cross /src/mpy-cross +COPY ./ports/unix /src/ports/unix +COPY ./py /src/py +COPY ./extmod /src/extmod +COPY ./shared /src/shared +COPY ./drivers /src/drivers +COPY ./tools /src/tools +COPY ./docs /src/docs + +WORKDIR /src + +RUN git submodule update --init --recursive lib/lv_bindings + +RUN make -C mpy-cross && \ + make -C ports/unix submodules VARIANT=dev && \ + make -C ports/unix VARIANT=dev + +FROM ubuntu + +COPY --from=builder /src/ports/unix/micropython-dev /usr/local/bin + +RUN apt-get update > /dev/null && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libsdl2-2.0-0 > /dev/null && \ + rm -rf /var/lib/apt/lists/* diff --git a/hooks/post_checkout b/hooks/post_checkout new file mode 100644 index 000000000..85080ca5b --- /dev/null +++ b/hooks/post_checkout @@ -0,0 +1,3 @@ +#!/bin/bash + +git submodule update --init --recursive