From bebf9be7f731766a7a17e0471fcf259fd74a007d Mon Sep 17 00:00:00 2001 From: Hugo Gomes Date: Mon, 23 Oct 2023 11:34:26 +0100 Subject: [PATCH] refactor: move from ubuntu_dev to a deno image --- .github/workflows/dockerx_deno.yml | 45 ++++++++++++++++++++++++++++ .github/workflows/dockerx_ubuntu.yml | 4 +-- deno/Dockerfile | 21 +++++++++++++ ubuntu_dev/Dockerfile | 19 ++---------- 4 files changed, 71 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/dockerx_deno.yml create mode 100644 deno/Dockerfile diff --git a/.github/workflows/dockerx_deno.yml b/.github/workflows/dockerx_deno.yml new file mode 100644 index 0000000..5b7a76a --- /dev/null +++ b/.github/workflows/dockerx_deno.yml @@ -0,0 +1,45 @@ +name: Build and Push Deno Images +on: + push: + branches-ignore: + - none + paths: + - "deno/**" + workflow_dispatch: +jobs: + build: + runs-on: self-hosted + timeout-minutes: 180 + strategy: + fail-fast: false + matrix: + config: + - { dockerfile: "deno/Dockerfile", context: "deno", image_name: "deno", tag_name: "latest" } + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set tag name based on branch + id: set_tag + run: | + if [[ "${{ github.ref_name }}" == "master" ]]; then + echo "tag=${{ matrix.config.tag_name }}" >> $GITHUB_OUTPUT + else + GITHUB_REFNAME=${{ github.ref_name }} + BRANCH_NAME=${GITHUB_REFNAME//\//_} + echo "tag=${{ matrix.config.tag_name }}-$BRANCH_NAME" >> $GITHUB_OUTPUT + fi + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: ${{ matrix.config.context }} + file: ${{ matrix.config.dockerfile }} + platforms: linux/amd64,linux/arm64/v8 + push: true + tags: hivesolutions/${{ matrix.config.image_name }}:${{ steps.set_tag.outputs.tag }} diff --git a/.github/workflows/dockerx_ubuntu.yml b/.github/workflows/dockerx_ubuntu.yml index 6206c7d..0c2630e 100644 --- a/.github/workflows/dockerx_ubuntu.yml +++ b/.github/workflows/dockerx_ubuntu.yml @@ -10,7 +10,7 @@ on: jobs: build: runs-on: self-hosted - timeout-minutes: 240 + timeout-minutes: 180 strategy: fail-fast: false matrix: @@ -52,6 +52,6 @@ jobs: with: context: ${{ matrix.config.context }} file: ${{ matrix.config.dockerfile }} - platforms: linux/amd64,linux/arm64/v8 + platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 push: true tags: hivesolutions/${{ matrix.config.image_name }}:${{ steps.set_tag.outputs.tag }} diff --git a/deno/Dockerfile b/deno/Dockerfile new file mode 100644 index 0000000..c1f0682 --- /dev/null +++ b/deno/Dockerfile @@ -0,0 +1,21 @@ +FROM hivesolutions/ubuntu:latest + +LABEL version="1.0" +LABEL maintainer="Hive Solutions " + +ENV RUST_VERSION 1.73.0 +ENV CARGO_HOME /usr/local/cargo +ENV PATH $CARGO_HOME/bin:$PATH + +ENV DENO_VERSION 1.37.1 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y -q --no-install-recommends build-essential curl clang\ + cmake libglib2.0-dev lld protobuf-compiler &&\ + curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain $RUST_VERSION -y &&\ + /usr/local/cargo/bin/cargo install --locked --version $DENO_VERSION deno &&\ + apt-get remove -y build-essential clang cmake libglib2.0-dev lld protobuf-compiler && apt-get autoremove -y &&\ + apt-get clean && rm -rf /var/lib/apt/lists/* + +CMD ["/bin/bash"] diff --git a/ubuntu_dev/Dockerfile b/ubuntu_dev/Dockerfile index 557b906..827b5ca 100644 --- a/ubuntu_dev/Dockerfile +++ b/ubuntu_dev/Dockerfile @@ -3,24 +3,11 @@ FROM hivesolutions/ubuntu:latest LABEL version="1.0" LABEL maintainer="Hive Solutions " -ENV RUST_VERSION 1.73.0 -ENV CARGO_HOME /usr/local/cargo -ENV PATH $CARGO_HOME/bin:$PATH - -ENV DENO_VERSION 1.37.1 - ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y -q --no-install-recommends sudo gcc make curl pypy\ - linux-headers-generic libssl-dev python2-dev python3-dev pypy-dev &&\ - apt-get clean && rm -rf /var/lib/apt/lists/* - -RUN curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain $RUST_VERSION -y - -RUN apt-get update && apt-get install -y -q --no-install-recommends build-essential clang\ - cmake libglib2.0-dev lld protobuf-compiler &&\ - /usr/local/cargo/bin/cargo install --locked --version $DENO_VERSION deno &&\ - apt-get remove -y build-essential clang cmake libglib2.0-dev lld protobuf-compiler && apt-get autoremove -y &&\ +RUN apt-get update &&\ + apt-get install -y -q --no-install-recommends sudo gcc make curl pypy linux-headers-generic\ + libssl-dev python2-dev python3-dev pypy-dev &&\ apt-get clean && rm -rf /var/lib/apt/lists/* CMD ["/bin/bash"]