diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b417adc23..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,104 +0,0 @@ -version: 2 -jobs: - # Define in CircleCi Project Variables: $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS - # Publish jobs require those variables - publish_docker_linuxamd64: - machine: - docker_layer_caching: false - steps: - - checkout - - run: - command: | - LATEST_TAG="${CIRCLE_TAG:1}" - DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-amd64" - DOCKERHUB_DOCKERFILE="dockerfiles/Dockerfile" - sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS - sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" . - sudo docker push "$DOCKERHUB_DESTINATION" - no_output_timeout: 25m - - publish_docker_linuxarm32v7: - machine: - docker_layer_caching: false - steps: - - checkout - - run: - command: | - sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset - LATEST_TAG="${CIRCLE_TAG:1}" - DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-arm32v7" - DOCKERHUB_DOCKERFILE="dockerfiles/Dockerfile.arm32v7" - sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS - sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" . - sudo docker push "$DOCKERHUB_DESTINATION" - no_output_timeout: 25m - - publish_docker_linuxarm64v8: - machine: - docker_layer_caching: false - steps: - - checkout - - run: - command: | - sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset - LATEST_TAG="${CIRCLE_TAG:1}" - DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-arm64v8" - DOCKERHUB_DOCKERFILE="dockerfiles/Dockerfile.arm64v8" - sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS - sudo docker build --pull -t "$DOCKERHUB_DESTINATION" -f "$DOCKERHUB_DOCKERFILE" . - sudo docker push "$DOCKERHUB_DESTINATION" - no_output_timeout: 25m - - publish_docker_multiarch: - machine: - enabled: true - image: circleci/classic:201808-01 - steps: - - run: - command: | - # Turn on Experimental features - LATEST_TAG="${CIRCLE_TAG:1}" - sudo mkdir $HOME/.docker - sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" >> $HOME/.docker/config.json' - # - sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS - # - sudo docker manifest create --amend "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-amd64" "$DOCKERHUB_REPO:$LATEST_TAG-arm32v7" "$DOCKERHUB_REPO:$LATEST_TAG-arm64v8" - sudo docker manifest annotate "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-amd64" --os linux --arch amd64 - sudo docker manifest annotate "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-arm32v7" --os linux --arch arm --variant v7 - sudo docker manifest annotate "$DOCKERHUB_REPO:$LATEST_TAG" "$DOCKERHUB_REPO:$LATEST_TAG-arm64v8" --os linux --arch arm64 --variant v8 - sudo docker manifest push "$DOCKERHUB_REPO:$LATEST_TAG" -p - no_output_timeout: 25m - -workflows: - version: 2 - publish: - jobs: - - publish_docker_linuxamd64: - filters: - branches: - ignore: /.*/ - tags: - only: /v(?:(?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?:([A-Za-z1-9])*))?)$/ - - publish_docker_linuxarm32v7: - filters: - branches: - ignore: /.*/ - tags: - only: /v(?:(?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?:([A-Za-z1-9])*))?)$/ - - publish_docker_linuxarm64v8: - filters: - branches: - ignore: /.*/ - tags: - only: /v(?:(?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?:([A-Za-z1-9])*))?)$/ - - publish_docker_multiarch: - requires: - - publish_docker_linuxamd64 - - publish_docker_linuxarm32v7 - - publish_docker_linuxarm64v8 - filters: - branches: - ignore: /.*/ - tags: - only: /v(?:(?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?:([A-Za-z1-9])*))?)$/ diff --git a/.github/workflows/docker-tag.yml b/.github/workflows/docker-tag.yml new file mode 100644 index 000000000..2bf3aafd2 --- /dev/null +++ b/.github/workflows/docker-tag.yml @@ -0,0 +1,43 @@ +name: Build stable Docker image + +on: + push: + tags: + - "v*" + +jobs: + build: + name: Build image + runs-on: ubuntu-20.04 + + steps: + - name: Checkout project + uses: actions/checkout@v2 + + - name: Set env variables + run: | + echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_ENV + REPO_OWNER=${{ github.repository_owner }} + echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + id: qemu + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v1 + id: buildx + + - name: Run Docker buildx + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64,linux/arm/v7 \ + --tag ghcr.io/$IMAGE_NAME:$BRANCH \ + --output "type=registry" . diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..04e965480 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,43 @@ +name: Build latest Docker image + +on: + push: + branches: [ master ] + workflow_dispatch: + + +jobs: + build: + name: Build image + runs-on: ubuntu-20.04 + + steps: + - name: Checkout project + uses: actions/checkout@v2 + + - name: Set env variables + run: | + echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_ENV + echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + id: qemu + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v1 + id: buildx + + - name: Run Docker buildx + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64,linux/arm/v7 \ + --tag ghcr.io/$IMAGE_NAME:$BRANCH \ + --output "type=registry" . diff --git a/dockerfiles/Dockerfile b/Dockerfile similarity index 100% rename from dockerfiles/Dockerfile rename to Dockerfile diff --git a/dockerfiles/Dockerfile.arm32v7 b/dockerfiles/Dockerfile.arm32v7 deleted file mode 100644 index 17e5836fe..000000000 --- a/dockerfiles/Dockerfile.arm32v7 +++ /dev/null @@ -1,49 +0,0 @@ -# --------------- -# Install Dependencies -# --------------- -FROM node:16-stretch-slim as builder - -ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel /tini -ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel.asc /tini.asc -RUN chmod +x /tini - -WORKDIR /RTL - -COPY package.json /RTL/package.json -COPY package-lock.json /RTL/package-lock.json - -RUN npm install - -# --------------- -# Build App -# --------------- -COPY . . - -# Build the Angular application -RUN npm run buildfrontend - -# Build the Backend from typescript server -RUN npm run buildbackend - -# Remove non production necessary modules -RUN npm prune --production - -# --------------- -# Release App -# --------------- -FROM arm32v7/node:16-stretch-slim as runner - -WORKDIR /RTL - -COPY --from=builder /RTL/rtl.js ./rtl.js -COPY --from=builder /RTL/package.json ./package.json -COPY --from=builder /RTL/frontend ./frontend -COPY --from=builder /RTL/backend ./backend -COPY --from=builder /RTL/node_modules/ ./node_modules -COPY --from=builder "/tini" /sbin/tini - -EXPOSE 3000 - -ENTRYPOINT ["/sbin/tini", "-g", "--"] - -CMD ["node", "rtl"] diff --git a/dockerfiles/Dockerfile.arm64v8 b/dockerfiles/Dockerfile.arm64v8 deleted file mode 100644 index 3f53172de..000000000 --- a/dockerfiles/Dockerfile.arm64v8 +++ /dev/null @@ -1,48 +0,0 @@ -# --------------- -# Install Dependencies -# --------------- -FROM node:16-stretch-slim as builder - -ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-arm64 /tini -RUN chmod +x /tini - -WORKDIR /RTL - -COPY package.json /RTL/package.json -COPY package-lock.json /RTL/package-lock.json - -RUN npm install - -# --------------- -# Build App -# --------------- -COPY . . - -# Build the Angular application -RUN npm run buildfrontend - -# Build the Backend from typescript server -RUN npm run buildbackend - -# Remove non production necessary modules -RUN npm prune --production - -# --------------- -# Release App -# --------------- -FROM arm64v8/node:16-stretch-slim as runner - -WORKDIR /RTL - -COPY --from=builder /RTL/rtl.js ./rtl.js -COPY --from=builder /RTL/package.json ./package.json -COPY --from=builder /RTL/frontend ./frontend -COPY --from=builder /RTL/backend ./backend -COPY --from=builder /RTL/node_modules/ ./node_modules -COPY --from=builder "/tini" /sbin/tini - -EXPOSE 3000 - -ENTRYPOINT ["/sbin/tini", "-g", "--"] - -CMD ["node", "rtl"]