-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
227 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## [project-title] Changelog | ||
|
||
<a name="x.y.z"></a> | ||
# x.y.z (yyyy-mm-dd) | ||
|
||
*Features* | ||
* ... | ||
|
||
*Bug Fixes* | ||
* ... | ||
|
||
*Breaking Changes* | ||
* ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Contributing to [project-title] | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
|
||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
- [Code of Conduct](#coc) | ||
- [Issues and Bugs](#issue) | ||
- [Feature Requests](#feature) | ||
- [Submission Guidelines](#submit) | ||
|
||
## <a name="coc"></a> Code of Conduct | ||
Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
|
||
## <a name="issue"></a> Found an Issue? | ||
If you find a bug in the source code or a mistake in the documentation, you can help us by | ||
[submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can | ||
[submit a Pull Request](#submit-pr) with a fix. | ||
|
||
## <a name="feature"></a> Want a Feature? | ||
You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub | ||
Repository. If you would like to *implement* a new feature, please submit an issue with | ||
a proposal for your work first, to be sure that we can use it. | ||
|
||
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr). | ||
|
||
## <a name="submit"></a> Submission Guidelines | ||
|
||
### <a name="submit-issue"></a> Submitting an Issue | ||
Before you submit an issue, search the archive, maybe your question was already answered. | ||
|
||
If your issue appears to be a bug, and hasn't been reported, open a new issue. | ||
Help us to maximize the effort we can spend fixing issues and adding new | ||
features, by not reporting duplicate issues. Providing the following information will increase the | ||
chances of your issue being dealt with quickly: | ||
|
||
* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps | ||
* **Version** - what version is affected (e.g. 0.1.2) | ||
* **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you | ||
* **Browsers and Operating System** - is this a problem with all browsers? | ||
* **Reproduce the Error** - provide a live example or a unambiguous set of steps | ||
* **Related Issues** - has a similar issue been reported before? | ||
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be | ||
causing the problem (line of code or commit) | ||
|
||
You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new]. | ||
|
||
### <a name="submit-pr"></a> Submitting a Pull Request (PR) | ||
Before you submit your Pull Request (PR) consider the following guidelines: | ||
|
||
* Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR | ||
that relates to your submission. You don't want to duplicate effort. | ||
|
||
* Make your changes in a new git fork: | ||
|
||
* Commit your changes using a descriptive commit message | ||
* Push your fork to GitHub: | ||
* In GitHub, create a pull request | ||
* If we suggest changes then: | ||
* Make the required updates. | ||
* Rebase your fork and force push to your GitHub repository (this will update your Pull Request): | ||
|
||
```shell | ||
git rebase master -i | ||
git push -f | ||
``` | ||
|
||
That's it! Thank you for your contribution! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM node:9-alpine | ||
|
||
COPY . /src | ||
RUN cd /src && npm install | ||
EXPOSE 80 | ||
CMD ["node", "/src/server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ARG REGISTRY_NAME | ||
FROM ${REGISTRY_NAME}/baseimages/node:9-alpine | ||
|
||
COPY . /src | ||
RUN cd /src && npm install | ||
EXPOSE 80 | ||
CMD ["node", "/src/server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM node:9-alpine | ||
ENV NODE_VERSION 9.11.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# ACR Build Hello World | ||
|
||
This Node.js application is for use in demonstrating scenarios for Azure Container Registry Tasks. [ACR Tasks](https://docs.microsoft.com/azure/container-registry/container-registry-tasks-overview) is a suite of features within [Azure Container Registry](https://azure.microsoft.com/services/container-registry/) for performing Docker container builds on [Azure](https://azure.com), as well as automated OS and framework patching for Docker containers. | ||
|
||
## Features | ||
|
||
This project includes the following Dockerfiles: | ||
|
||
* *Dockerfile* - Non-parameterized Dockerfile for building the application. References a base image in Docker Hub. | ||
* *Dockerfile-app* - Parameterized, accepts the `REGISTRY_NAME` argument to specify the FQDN of the container registry from which the base image is pulled. | ||
* *Dockerfile-base* - Defines a base image for the application defined in *Dockerfile-app*. | ||
|
||
This project also includes the following YAML files: | ||
|
||
* *taskmulti.yaml* - Specifies a multistep task to build, run, and push a container image specified by *Dockerfile*. | ||
* *taskmulti-multiregistry.yaml* - Specifies a multistep task to build, run, and push container images specified by *Dockerfile* to multiple registries. | ||
|
||
## Getting Started | ||
|
||
### Companion articles | ||
|
||
This project is intended for use with the following articles on [docs.microsoft.com][docs]: | ||
|
||
* [Build container images in the cloud with Azure Container Registry Tasks][build-quick] | ||
* [Automate container image builds in the cloud when you commit source code][build-task] | ||
* [Run a multi-step container workflow in the cloud when you commit source code][multi-step] | ||
* [Automate container image builds when a base image is updated in an Azure container registry][build-base] | ||
|
||
### Quickstart | ||
|
||
Although intended for use with the companion articles, you can perform the following steps to run the sample application. These steps require a local [Docker](http://docker.com) installation. | ||
|
||
1. `git clone https://github.com/Azure-Samples/acr-build-helloworld-node` | ||
1. `cd acr-build-helloworld-node` | ||
1. `docker build -t helloacrbuild:v1 .` | ||
1. `docker run -d -p 8080:80 helloacrbuild:v1` | ||
1. Navigate to http://localhost:8080 to view the running application | ||
|
||
## Resources | ||
|
||
[Azure Container Registry](https://azure.microsoft.com/services/container-registry/) | ||
|
||
[Azure Container Registry documentation](https://docs.microsoft.com/azure/container-registry/) | ||
|
||
<!-- LINKS - External --> | ||
[build-quick]: https://docs.microsoft.com/azure/container-registry/container-registry-tutorial-quick-build | ||
[build-task]: https://docs.microsoft.com/azure/container-registry/container-registry-tutorial-build-task | ||
[build-base]: https://docs.microsoft.com/azure/container-registry/container-registry-tutorial-base-image-update | ||
[multi-step]: https://docs.microsoft.com/azure/container-registry/container-registry-tutorial-multistep-task | ||
[docs]: http://docs.microsoft.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "helloworld", | ||
"version": "1.0.0", | ||
"description": "Sample app for ACR Build", | ||
"main": "server.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "node server.js" | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const http = require('http') | ||
|
||
const port = 80 | ||
|
||
const server = http.createServer((request, response) => { | ||
response.writeHead(200, {'Content-Type': 'text/plain'}) | ||
response.write('Hello World\n') | ||
response.end('Version: ' + process.env.NODE_VERSION + '\n') | ||
}) | ||
|
||
server.listen(port) | ||
|
||
console.log(`Server running at http://localhost: ${port}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: v1.0.0 | ||
steps: | ||
# Build target images | ||
- build: -t {{.Run.Registry}}/hello-world:{{.Run.ID}} -f Dockerfile . | ||
- build: -t {{.Values.regDate}}/hello-world:{{.Run.Date}} -f Dockerfile . | ||
# Run image | ||
- cmd: -t {{.Run.Registry}}/hello-world:{{.Run.ID}} | ||
id: test | ||
detach: true | ||
ports: ["8080:80"] | ||
- cmd: docker stop test | ||
# Push images | ||
- push: | ||
- {{.Run.Registry}}/hello-world:{{.Run.ID}} | ||
- {{.Values.regDate}}/hello-world:{{.Run.Date}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: v1.0.0 | ||
steps: | ||
# Build target image | ||
- build: -t {{.Run.Registry}}/hello-world:{{.Run.ID}} -f Dockerfile . | ||
# Run image | ||
- cmd: -t {{.Run.Registry}}/hello-world:{{.Run.ID}} | ||
id: test | ||
detach: true | ||
ports: ["8080:80"] | ||
- cmd: docker stop test | ||
# Push image | ||
- push: | ||
- {{.Run.Registry}}/hello-world:{{.Run.ID}} |