
diff --git a/hello-arc-windows/src/app/Dockerfile b/hello-arc-windows/src/app/Dockerfile new file mode 100644 index 00000000..b73ef84e --- /dev/null +++ b/hello-arc-windows/src/app/Dockerfile @@ -0,0 +1,32 @@ +FROM azurearcjumpstart.azurecr.io/node-windows-servercore:ltsc2019 + +ARG IMAGE_CREATE_DATE +ARG IMAGE_VERSION +ARG IMAGE_SOURCE_REVISION + +# Metadata as defined in OCI image spec annotations - https://github.com/opencontainers/image-spec/blob/master/annotations.md +LABEL org.opencontainers.image.title="Hello Arc!" \ + org.opencontainers.image.description="Provides a demo app to deploy to an Azure Arc-enabled Kubernetes cluster. It displays a message, the name of the pod and details of the node it is deployed to." \ + org.opencontainers.image.created=$IMAGE_CREATE_DATE \ + org.opencontainers.image.version=$IMAGE_VERSION \ + org.opencontainers.image.authors="Jan Egil Ring" \ + org.opencontainers.image.url="azurearcjumpstart.azurecr.io/hello-arc:windows" \ + org.opencontainers.image.documentation="https://github.com/microsoft/azure-arc-jumpstart-apps/tree/main/hello-arc-windows" \ + org.opencontainers.image.vendor="Microsoft" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.source="https://github.com/microsoft/azure-arc-jumpstart-apps.git" \ + org.opencontainers.image.revision=$IMAGE_SOURCE_REVISION + +# Create app directory +RUN mkdir -p c:\app +WORKDIR c:\\app + +# Install app dependencies +COPY package.json c:\\app +RUN npm install + +# Bundle app source +COPY . c:\\app + +#USER node +CMD [ "C:\\nodejs\\npm.cmd", "start" ] diff --git a/hello-arc-windows/src/app/package.json b/hello-arc-windows/src/app/package.json new file mode 100644 index 00000000..a133b318 --- /dev/null +++ b/hello-arc-windows/src/app/package.json @@ -0,0 +1,19 @@ +{ + "name": "hello-kubernetes", + "version": "1.8.0", + "description": "Hello Kubernetes!", + "author": "Paul Bouwer", + "license": "MIT", + "main": "server.js", + "scripts": { + "start": "node server.js" + }, + "dependencies": { + "bytes": "^3.1.0", + "express": "^4.17.1", + "express-handlebars": "^3.1.0", + "handlebars": "^4.7.6", + "minimist": ">=1.2.5", + "morgan": "^1.9.1" + } +} diff --git a/hello-arc-windows/src/app/server.js b/hello-arc-windows/src/app/server.js new file mode 100644 index 00000000..2b53abe1 --- /dev/null +++ b/hello-arc-windows/src/app/server.js @@ -0,0 +1,28 @@ +var express = require('express'); +var exphbs = require('express-handlebars'); +var app = express(); +var os = require("os"); +var morgan = require('morgan'); + +app.engine('handlebars', exphbs({defaultLayout: 'main'})); +app.set('view engine', 'handlebars'); +app.use(express.static('static')); +app.use(morgan('combined')); + +// Configuration +var port = process.env.PORT || 8080; +var message = process.env.MESSAGE || "Hello Azure Arc GitOps Demo!"; + +app.get('/', function (req, res) { + res.render('home', { + message: message, + platform: os.type(), + release: os.release(), + hostName: os.hostname() + }); +}); + +// Set up listener +app.listen(port, function () { + console.log("Listening on: http://%s:%s", os.hostname(), port); +}); \ No newline at end of file diff --git a/hello-arc-windows/src/app/static/css/main.css b/hello-arc-windows/src/app/static/css/main.css new file mode 100644 index 00000000..ca013578 --- /dev/null +++ b/hello-arc-windows/src/app/static/css/main.css @@ -0,0 +1,49 @@ +body { + margin:0; + padding:0; + background-color:white; +} + +div.main { + text-align: center; +} + +div.main img { + margin: 40px 0; +} + +div.content { + color:#f2f2f2; +} +.content #message { + margin: 10px 0 50px 0; + padding: 30px 0; + font-family: 'Ubuntu', sans-serif; + font-weight: 300; + font-size: 44pt; + background-color: #1a6ad3; + /* border-top: 2px solid #909090; + border-bottom: 2px solid #909090; */ +} + +.content #info { + margin: 0 auto; + font-family: 'Ubuntu', sans-serif; + font-weight: 300; + font-size: 16pt; + color: black; +} + +.content #info table { + margin: 10px auto; +} + +.content #info table th { + text-align: right; + padding-right: 20px; +} + +.content #info table td { + text-align: left; +} + diff --git a/hello-arc-windows/src/app/static/images/logo.png b/hello-arc-windows/src/app/static/images/logo.png new file mode 100644 index 00000000..c3948714 Binary files /dev/null and b/hello-arc-windows/src/app/static/images/logo.png differ diff --git a/hello-arc-windows/src/app/views/home.handlebars b/hello-arc-windows/src/app/views/home.handlebars new file mode 100644 index 00000000..88daf470 --- /dev/null +++ b/hello-arc-windows/src/app/views/home.handlebars @@ -0,0 +1,16 @@ +
pod: | +{{ hostName }} | +
---|---|
node: | +{{ platform }} ({{ release }}) | +