Skip to content

Latest commit

 

History

History
32 lines (31 loc) · 2.63 KB

README.md

File metadata and controls

32 lines (31 loc) · 2.63 KB

Hands-on

Prerequisites

Instructions

  1. Clone the repository
  2. Open the project in VS Code (or your preferred IDE)
  3. Create a file named Dockerfile in the root directory of your project
  4. To build the image, the Dockerfile should contain the following instructions (docs)
    • Set the base image to node:12-alpine
    • Run the command apk add --no-cache python3 g++ make to install some packages
    • Set the working directory to /app for any following command in the dockerfile
    • Copy all files from the current context of the Dockerfile to the current working directory
    • Run the command yarn install --production to install all the application dependencies
    • Set the default command for a starting container to node src/index.js
    • the running container should listen on port 3000
  5. Build the Image and tag it with "getting-started:1.0" (in case you are building on ARM use --platform linux/amd64 flag)
  6. Create an ACR in Azure
    • az login & az account show to check if you are in the right subscription
    • Create a resource group with az group create --name container-gettingstarted-<shortname> --location westeurope --tags purpose=handson
    • Create an ACR with az acr create --resource-group container-gettingstarted-<shortname> --name container0gettingstarted0<shortname> --sku Basic --admin-enabled
    • check the output and write down the "loginServer" value
    • log in to the ACR after creation with az acr login --name container0gettingstarted0<shortname>
  7. Re-tag the image with <loginServer>/getting-started:1.0
  8. Push the image to the ACR (docker push command)
  9. Deploy the image to Azure Container Apps.
    • (Optional) Execute the following commands to upgrade your Azure CLI
      • az extension add --name containerapp --upgrade
    • Create an ACA environment with az containerapp env create --name getting-started-aca --resource-group container-gettingstarted-<shortname> --location westeurope
    • Deploy your image to the ACA environment (find the credentials of your ACR in Azure) with az containerapp create --name <name> --resource-group <resourceGroupName> --environment <AcaEnvName> --image <loginServer>/<imageName:tag> --target-port <port> --ingress 'external' --query properties.configuration.ingress.fqdn --registry-server <loginServer> --registry-username <loginUsername> --registry-password <loginPassword>
    • Copy the URL from the output and verify that your app is online