Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy"
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot-chat"
]
}
},
"features": {
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/azure/azure-dev/azd:0": {}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/my-container-app-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: my-container-app-1

on:
workflow_dispatch:
push:
branches:
- monorepo-action

defaults:
run:
working-directory: my-container-app-1

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: LS
run: ls


- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: dfberryregistry.azurecr.io
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

- name: Print length of username and password
run: |
echo "Username length: ${#ACR_USERNAME}"
echo "Password length: ${#ACR_PASSWORD}"
echo "First 3 letters of username: ${ACR_USERNAME:0:3}"
echo "First 3 letters of password: ${ACR_PASSWORD:0:3}"
env:
ACR_USERNAME: ${{ secrets.ACR_USERNAME }}
ACR_PASSWORD: ${{ secrets.ACR_PASSWORD }}

- name: Build and push Docker image
run: |
docker build -t dfberryregistry.azurecr.io/my-container-app:latest .
docker push dfberryregistry.azurecr.io/my-container-app:latest

# - name: Azure Login
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS }}

# - name: Deploy to Azure Container Apps
# run: |
# az containerapp update \
# --name my-container-app \
# --resource-group my-resource-group \
# --image ${{ secrets.ACR_LOGIN_SERVER }}/my-container-app:latest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
node_modules
.env*
21 changes: 21 additions & 0 deletions my-container-app-1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Use the official Node.js image as the base image
FROM node:18

# Set the working directory inside the container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install the dependencies
RUN npm install

# Copy the rest of the application code to the working directory
COPY . .

EXPOSE 3000

ENV PORT 3000

# Define the command to run the application
CMD ["node", "index.js"]
23 changes: 23 additions & 0 deletions my-container-app-1/create-container-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
AZURE_SUBSCRIPTION_ID="19016922-4bf5-4c41-9553-8eff5da1500e"
AZURE_RESOURCE_GROUP="rust-axum-server"
AZURE_REGISTRY_NAME="dfberryregistry"
AZURE_LOCATION="eastus2"
AZURE_CONTAINER_APP_NAME="my-container-app-1"
AZURE_CONTAINER_APP_ENV_NAME="managedEnvironment-rustaxumserver-a56d"
TARGET_PORT=3000

# Create Azure container app
az containerapp create \
--subscription $AZURE_SUBSCRIPTION_ID \
--resource-group $AZURE_RESOURCE_GROUP \
--name $AZURE_CONTAINER_APP_NAME \
--environment ${AZURE_CONTAINER_APP_ENV_NAME}

# Enable ingress for Azure Container App
az containerapp ingress enable \
--subscription $AZURE_SUBSCRIPTION_ID \
--name $AZURE_CONTAINER_APP_NAME \
--resource-group $AZURE_RESOURCE_GROUP \
--target-port $TARGET_PORT \
--transport http \
--type external
16 changes: 16 additions & 0 deletions my-container-app-1/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Import the express module
const express = require('express');

// Initialize the express application
const app = express();

// Define a simple route
app.get('/', (req, res) => {
res.json({ message: 'Hello, world - 1' });
});

// Start the server on port 3000
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
1 change: 1 addition & 0 deletions my-container-app-1/my-container-app-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello
Loading