├── .gitignore ├── .vscode └── tasks.json ├── Dockerfile ├── LICENSE ├── README.md ├── docker-entrypoint.sh └── scripts └── change-version-to /.gitignore: -------------------------------------------------------------------------------- 1 | *-E 2 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Build Dockerfile", 8 | "type": "shell", 9 | "command": "docker build --build-arg ANGULAR_CLI_VERSION=${input:cliversion} -t alexsuch/angular-cli:${input:cliversion} .", 10 | "group": { 11 | "kind": "build", 12 | "isDefault": true 13 | } 14 | }, 15 | { 16 | "label": "Test angular-cli version", 17 | "type": "shell", 18 | // ng v14+ changed from ng --version to ng version 19 | "command": "docker run -it --rm alexsuch/angular-cli:${input:cliversion} ng version", 20 | "problemMatcher": [] 21 | }, 22 | { 23 | "label": "Push angular-cli image", 24 | "type": "shell", 25 | "command": "docker push alexsuch/angular-cli:${input:cliversion}", 26 | "problemMatcher": [] 27 | } 28 | ], 29 | // https://code.visualstudio.com/docs/editor/variables-reference#_input-variables 30 | "inputs": [ 31 | { 32 | "id": "cliversion", 33 | "type": "promptString", 34 | "description": "Angular CLI version of the Docker image", 35 | "default": "latest" 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18.18.0-alpine 2 | 3 | LABEL authors="Alejandro Such , Mihai Bob , Dinei A. Rockenbach " 4 | 5 | ARG ANGULAR_CLI_VERSION=latest 6 | ENV NG_CLI_ANALYTICS=false 7 | 8 | RUN apk update \ 9 | && apk add --update alpine-sdk python3 \ 10 | && yarn global add @angular/cli@$ANGULAR_CLI_VERSION \ 11 | && ng config --global cli.packageManager yarn \ 12 | && apk del alpine-sdk python3 \ 13 | && rm -rf /tmp/* /var/cache/apk/* *.tar.gz ~/.npm \ 14 | && npm cache clean --force \ 15 | && yarn cache clean \ 16 | && sed -i -e "s/bin\/ash/bin\/sh/" /etc/passwd 17 | 18 | EXPOSE 4200 19 | 20 | # Replaces default node entrypoint to allow/force "ng" command by default 21 | COPY docker-entrypoint.sh /usr/local/bin/ 22 | 23 | CMD [ "ng" ] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alejandro Such Berenguer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | _ _ ____ _ ___ 3 | / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| 4 | / △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | | 5 | / ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | | 6 | /_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___| 7 | |___/ 8 | ``` 9 | 10 | **@angular/cli:** 14.0.6
11 | **node:** 14.18.0
12 | **npm:** 6.14.15
13 | **yarn:** 1.22.5
14 | **os:** linux x64
15 | **package manager:** yarn
16 | **docker hub:** https://hub.docker.com/r/alexsuch/angular-cli/ 17 | 18 | [![Docker Pulls](https://img.shields.io/docker/pulls/alexsuch/angular-cli.svg)](https://hub.docker.com/r/alexsuch/angular-cli/) 19 | [![Docker Stars](https://img.shields.io/docker/stars/alexsuch/angular-cli.svg)](https://hub.docker.com/r/alexsuch/angular-cli/) 20 | 21 | ## Usage examples 22 | 23 | This image has the same usage as Angular CLI (https://cli.angular.io/) 24 | 25 | ### Creating a project 26 | 27 | ``` 28 | docker run -it --rm -w /app -v $(pwd):/app alexsuch/angular-cli ng new my-project-name 29 | ``` 30 | 31 | ### Generating a component 32 | 33 | ``` 34 | docker run -it --rm -w /app -v $(pwd)/my-project-name:/app alexsuch/angular-cli ng g component sample-component 35 | ``` 36 | 37 | ### Serving 38 | 39 | ``` 40 | docker run -it --rm -w /app -v $(pwd)/my-project-name:/app -p 4200:4200 alexsuch/angular-cli ng serve --host 0.0.0.0 41 | ``` 42 | 43 | ## Credits 44 | 45 | All credits for the CLI go for [the Angular CLI team](https://github.com/angular/angular-cli). 46 | 47 | This Docker image has been made with ❤️ by [Alejandro Such ](https://twitter.com/alejandro_such) and all these wonderful contributors: 48 | 49 | - [Mihai Bob](https://github.com/Mihai-B) 50 | - [Daniel Schreiber](https://github.com/daniel-sc) 51 | - [nlko](https://github.com/nlko) 52 | - [Michaël van de Giessen](https://github.com/tubbynl) 53 | - [Dinei A. Rockenbach](https://github.com/dineiar) 54 | 55 | ## License 56 | 57 | MIT 58 | 59 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then 5 | set -- ng "$@" 6 | fi 7 | 8 | exec "$@" 9 | -------------------------------------------------------------------------------- /scripts/change-version-to: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | switch_to_branch() { 4 | local BRANCH=$1 5 | 6 | git checkout $BRANCH 7 | git pull origin $BRANCH 8 | } 9 | 10 | replace_files_with() { 11 | local VERSION=$1 12 | local SUFFIX="" 13 | 14 | if [ ! -z "$2" ]; then 15 | SUFFIX=$2 16 | fi 17 | 18 | sed -i -E "s:\(@angular/cli@\).*\(\s*\\\\\):\1$VERSION \2:" Dockerfile 19 | sed -i -E "s/\(@angular\/cli:\*\*\).*\(\)/\1 $VERSION\2/" README.md 20 | sed -i -E "s/\(alexsuch\/angular-cli:\).*\(ng\)/\1$VERSION$SUFFIX \2/" README.md 21 | } 22 | 23 | build_docker() { 24 | local VERSION=$1 25 | local SUFFIX="" 26 | 27 | if [ ! -z "$2" ]; then 28 | SUFFIX=$2 29 | fi 30 | 31 | docker build -t alexsuch/angular-cli:$VERSION$SUFFIX . 32 | return $? 33 | } 34 | 35 | on_success() { 36 | local VERSION=$1 37 | local BRANCHNAME=$2 38 | local SUFFIX="" 39 | 40 | if [ ! -z "$3" ]; then 41 | SUFFIX=$3 42 | fi 43 | 44 | local DEFAULT_MSG="Update CLI version to $VERSION$SUFFIX" 45 | 46 | clear 47 | echo "Success!" 48 | echo "Sending changes to github" 49 | echo "Default message will be '$DEFAULT_MSG'" 50 | read -p "Write your message (Hit ENTER for default message): " COMMIT_MSG 51 | 52 | if [[ -z "$COMMIT_MSG" ]]; then 53 | COMMIT_MSG=$DEFAULT_MSG 54 | fi 55 | 56 | echo "Committing files" 57 | git add Dockerfile README.md 58 | git commit -m "$COMMIT_MSG" 59 | git tag -a $VERSION$SUFFIX -m "version $VERSION$SUFFIX" 60 | 61 | echo "Pushing to Github" 62 | git push origin $BRANCHNAME 63 | 64 | echo "Generating release $VERSION$SUFFIX" 65 | curl --data "{\"tag_name\": \"$VERSION$SUFFIX\", 66 | \"target_commitish\": \"$BRANCHNAME\", 67 | \"name\": \"v$VERSION$SUFFIX\", 68 | \"body\": \"Release of version $VERSION$SUFFIX\", 69 | \"draft\": false, 70 | \"prerelease\": false}" \ 71 | https://api.github.com/repos/alejandroSuch/angular-cli/releases?access_token=$GITHUB_ACCESS_TOKEN 72 | 73 | echo "Success!" 74 | } 75 | 76 | on_error() { 77 | clear 78 | echo "Docker build failed!" 79 | exit 1 80 | } 81 | 82 | if [ $# -eq 0 ]; then 83 | echo "Version is required" 84 | exit 1 85 | fi 86 | 87 | VERSION=$1 88 | BRANCHNAME="" 89 | ## STANDARD VERSION 90 | 91 | if [[ $VERSION == 1.3.* ]]; then 92 | BRANCHNAME="1.3.x" 93 | elif [[ $VERSION == 1.4.* ]]; then 94 | BRANCHNAME="1.4.x" 95 | elif [[ $VERSION == 1.5.* ]]; then 96 | BRANCHNAME="1.5.x" 97 | elif [[ $VERSION == 1.6.* ]]; then 98 | BRANCHNAME="1.6.x" 99 | elif [[ $VERSION == 1.7.* ]]; then 100 | BRANCHNAME="1.7.x" 101 | elif [[ $VERSION == 6.0.* ]]; then 102 | BRANCHNAME="6.0.x" 103 | elif [[ $VERSION == 6.1.* ]]; then 104 | BRANCHNAME="6.1.x" 105 | elif [[ $VERSION == 6.2.* ]]; then 106 | BRANCHNAME="6.2.x" 107 | elif [[ $VERSION == 7.0.* ]]; then 108 | BRANCHNAME="7.0.x" 109 | elif [[ $VERSION == 7.3.* ]]; then 110 | BRANCHNAME="7.3.x" 111 | fi 112 | 113 | switch_to_branch $BRANCHNAME 114 | replace_files_with $VERSION 115 | build_docker $VERSION 116 | DOCKER_BUILD_RESULT=$? 117 | 118 | if [ $DOCKER_BUILD_RESULT -eq 0 ]; then 119 | on_success $VERSION $BRANCHNAME 120 | else 121 | on_error 122 | fi 123 | 124 | ## CHROMIUM VERSION 125 | 126 | if [[ $VERSION == 1.3.* ]]; then 127 | BRANCHNAME="1.3.x-chromium" 128 | elif [[ $VERSION == 1.4.* ]]; then 129 | BRANCHNAME="1.4.x-chromium" 130 | elif [[ $VERSION == 1.5.* ]]; then 131 | BRANCHNAME="1.5.x-chromium" 132 | elif [[ $VERSION == 1.6.* ]]; then 133 | BRANCHNAME="1.6.x-chromium" 134 | elif [[ $VERSION == 1.7.* ]]; then 135 | BRANCHNAME="1.7.x-chromium" 136 | elif [[ $VERSION == 6.0.* ]]; then 137 | BRANCHNAME="6.0.x-chromium" 138 | elif [[ $VERSION == 6.1.* ]]; then 139 | BRANCHNAME="6.1.x-chromium" 140 | elif [[ $VERSION == 6.2.* ]]; then 141 | BRANCHNAME="6.2.x-chromium" 142 | elif [[ $VERSION == 7.0.* ]]; then 143 | BRANCHNAME="7.0.x-chromium" 144 | elif [[ $VERSION == 7.3.* ]]; then 145 | BRANCHNAME="7.3.x-chromium" 146 | fi 147 | 148 | switch_to_branch $BRANCHNAME 149 | replace_files_with $VERSION "-chromium" 150 | build_docker $VERSION "-chromium" 151 | DOCKER_BUILD_RESULT=$? 152 | 153 | if [ $DOCKER_BUILD_RESULT -eq 0 ]; then 154 | on_success $VERSION $BRANCHNAME "-chromium" 155 | else 156 | on_error 157 | fi 158 | 159 | switch_to_branch "master" 160 | --------------------------------------------------------------------------------