Feature: docker image (#57)
This commit is contained in:
Родитель
88a51f1b6d
Коммит
02d9f1299c
|
@ -0,0 +1,9 @@
|
|||
**/node_modules
|
||||
**/dist
|
||||
|
||||
# Rush files
|
||||
common/temp/**
|
||||
package-deps.json
|
||||
|
||||
# tsc incremental build files
|
||||
**/*.tsbuildinfo
|
|
@ -36,6 +36,12 @@ using the preview.
|
|||
|
||||
## Getting Started
|
||||
|
||||
### Using Docker
|
||||
|
||||
[See docker documentation](./docs/docker.md)
|
||||
|
||||
### Using Node & Npm
|
||||
|
||||
1. Install [Node.js 14 LTS](https://nodejs.org/en/download/) and ensure you are able to run the `npm` command in a command prompt:
|
||||
|
||||
```
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"changes": [
|
||||
{
|
||||
"packageName": "tmlanguage-generator",
|
||||
"comment": "",
|
||||
"type": "none"
|
||||
}
|
||||
],
|
||||
"packageName": "tmlanguage-generator"
|
||||
}
|
|
@ -3032,10 +3032,11 @@ packages:
|
|||
'@types/plist': 3.0.2
|
||||
onigasm: 2.2.5
|
||||
plist: 3.0.4
|
||||
typescript: 4.4.4
|
||||
dev: false
|
||||
name: '@rush-temp/tmlanguage-generator'
|
||||
resolution:
|
||||
integrity: sha512-WM1WhCLQw/RzuttQrS7QutOHooQHzcxlNAI8Jv5FUgaPmH7OGl7G3m/dH8KcWE4vSQRteEKlCNqeHU8w1z152w==
|
||||
integrity: sha512-knw/L+Bae0ugyw0PdTcsoHMPZIAuAz07xX0LuxYb3mcXklWfh3ubNBGuNnn94abkOXM5yd6fiWgwtgpwowPREg==
|
||||
tarball: file:projects/tmlanguage-generator.tgz
|
||||
version: 0.0.0
|
||||
specifiers:
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# --------------------------------
|
||||
# Build compiler
|
||||
# --------------------------------
|
||||
FROM node:16-alpine3.12 as builder
|
||||
|
||||
COPY . /app
|
||||
|
||||
WORKDIR /app
|
||||
RUN npm install -g @microsoft/rush
|
||||
RUN rush install
|
||||
RUN rush rebuild
|
||||
|
||||
WORKDIR /app/packages/compiler
|
||||
RUN npm pack
|
||||
|
||||
# --------------------------------
|
||||
# Setup final image
|
||||
# --------------------------------
|
||||
FROM node:16-alpine3.12
|
||||
|
||||
COPY --from=builder /app/packages/compiler/*.tgz /tmp/compiler.tgz
|
||||
|
||||
RUN npm install -g /tmp/compiler.tgz && rm /tmp/compiler.tgz
|
||||
|
||||
ENTRYPOINT [ "cadl" ]
|
|
@ -0,0 +1,36 @@
|
|||
# Use cadl via docker
|
||||
|
||||
Image: `azsdkengsys.azurecr.io/cadl`
|
||||
|
||||
Tags:
|
||||
|
||||
- Lastest from master: `alpine`, `latest`
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-v "${pwd}:/wd" --workdir="/wd" \
|
||||
-t azsdkengsys.azurecr.io/cadl \
|
||||
# ... cadl args ...
|
||||
```
|
||||
|
||||
**For usage in powershell replace `\` with `` ` ``**
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```bash
|
||||
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/cadl install
|
||||
```
|
||||
|
||||
### Compile
|
||||
|
||||
```bash
|
||||
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/cadl compile .
|
||||
```
|
||||
|
||||
### Init a new project
|
||||
|
||||
```bash
|
||||
docker run -v "${pwd}:/wd" --workdir="/wd" -t azsdkengsys.azurecr.io/cadl init
|
||||
```
|
|
@ -4,31 +4,57 @@ trigger:
|
|||
- main
|
||||
pr: none
|
||||
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
jobs:
|
||||
- job: npm
|
||||
displayName: Npm publish
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: 14.x
|
||||
displayName: Install Node.js
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: 14.x
|
||||
displayName: Install Node.js
|
||||
- script: echo '##vso[task.setvariable variable=CADL_VS_CI_BUILD;]true'
|
||||
displayName: Enable official Visual Studio extension build
|
||||
|
||||
- script: echo '##vso[task.setvariable variable=CADL_VS_CI_BUILD;]true'
|
||||
displayName: Enable official Visual Studio extension build
|
||||
- script: node common/scripts/install-run-rush.js install
|
||||
displayName: Install JavaScript Dependencies
|
||||
|
||||
- script: node common/scripts/install-run-rush.js install
|
||||
displayName: Install JavaScript Dependencies
|
||||
- script: node packages/cadl-vs/scripts/build.js --restore
|
||||
displayName: Restore .NET Dependencies
|
||||
|
||||
- script: node packages/cadl-vs/scripts/build.js --restore
|
||||
displayName: Restore .NET Dependencies
|
||||
- script: node common/scripts/install-run-rush.js rebuild --verbose
|
||||
displayName: Build
|
||||
|
||||
- script: node common/scripts/install-run-rush.js rebuild --verbose
|
||||
displayName: Build
|
||||
- script: node common/scripts/install-run-rush.js test-official
|
||||
displayName: Test
|
||||
|
||||
- script: node common/scripts/install-run-rush.js test-official
|
||||
displayName: Test
|
||||
- script: |
|
||||
set NPM_AUTH_TOKEN=$(azure-sdk-npm-token)
|
||||
node common/scripts/install-run-rush.js publish --publish --include-all --set-access-level public
|
||||
displayName: Release
|
||||
|
||||
- script: |
|
||||
set NPM_AUTH_TOKEN=$(azure-sdk-npm-token)
|
||||
node common/scripts/install-run-rush.js publish --publish --include-all --set-access-level public
|
||||
displayName: Release
|
||||
- job: docker
|
||||
displayName: Docker build and publish
|
||||
variables:
|
||||
imageName: "azsdkengsys.azurecr.io/cadl"
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: Docker@1
|
||||
displayName: login
|
||||
inputs:
|
||||
azureSubscriptionEndpoint: "AzureSDKEngKeyVault Secrets"
|
||||
azureContainerRegistry: azsdkengsys.azurecr.io
|
||||
command: login
|
||||
|
||||
- script: |
|
||||
docker build -f ./docker/Dockerfile \
|
||||
-t $(imageName):latest \
|
||||
-t $(imageName):alpine \
|
||||
.
|
||||
displayName: "Build"
|
||||
|
||||
- script: docker push $(imageName) --all-tags
|
||||
displayName: "Push"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "~14.0.27",
|
||||
"@types/plist": "~3.0.2"
|
||||
"@types/plist": "~3.0.2",
|
||||
"typescript": "~4.4.4"
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче