Skip to content

Commit

Permalink
aca
Browse files Browse the repository at this point in the history
  • Loading branch information
vhvb1989 committed Jan 5, 2024
1 parent 36153e4 commit 148a834
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
15 changes: 11 additions & 4 deletions templates/todo/projects/java-mongo-aca/.repo/bicep/azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ services:
language: js
host: containerapp
hooks:
# When azd runs package, the static-web-app-required .env-values (from azd env) are not visible to `npm run build`.
# This hook creates a temporary `.env.local` file for the build command. Vite will automatically use it during build.
# When azd runs package, the static-web-app-required azd-.env-values are not visible to `docker build`.
# This hook creates a temporary `.env.local` file for the build command. Vite will automatically use it during docker image creation.
# The expected/required values are mapped to the infrastructure outputs.
# .env.local is ignored by git, so it will not be committed if for any reason the hook does not remove it at the end.
# see: https://vitejs.dev/guide/env-and-mode
# Note: Notice that dotenv must be a project dependency for this to work. See package.json.
predeploy:
windows:
shell: pwsh
run: 'echo "VITE_API_BASE_URL=\"$env:API_BASE_URL\"" > .env.local ; echo "VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$env:APPLICATIONINSIGHTS_CONNECTION_STRING\"" >> .env.local ; npm run build; rm .env.local'
run: 'echo "VITE_API_BASE_URL=\"$env:API_BASE_URL\"" > .env.local ; echo "VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$env:APPLICATIONINSIGHTS_CONNECTION_STRING\"" >> .env.local'
posix:
shell: sh
run: 'echo VITE_API_BASE_URL=\"$API_BASE_URL\" > .env.local && echo VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$APPLICATIONINSIGHTS_CONNECTION_STRING\" >> .env.local && npm install && npm run build && rm .env.local'
run: 'echo VITE_API_BASE_URL=\"$API_BASE_URL\" > .env.local && echo VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$APPLICATIONINSIGHTS_CONNECTION_STRING\" >> .env.local'
postdeploy:
windows:
shell: pwsh
run: 'rm .env.local'
posix:
shell: sh
run: 'rm .env.local'
api:
project: ../../api/java
language: java
Expand Down
15 changes: 11 additions & 4 deletions templates/todo/projects/nodejs-mongo-aca/.repo/bicep/azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ services:
language: js
host: containerapp
hooks:
# When azd runs package, the static-web-app-required .env-values (from azd env) are not visible to `npm run build`.
# This hook creates a temporary `.env.local` file for the build command. Vite will automatically use it during build.
# When azd runs package, the static-web-app-required azd-.env-values are not visible to `docker build`.
# This hook creates a temporary `.env.local` file for the build command. Vite will automatically use it during docker image creation.
# The expected/required values are mapped to the infrastructure outputs.
# .env.local is ignored by git, so it will not be committed if for any reason the hook does not remove it at the end.
# see: https://vitejs.dev/guide/env-and-mode
# Note: Notice that dotenv must be a project dependency for this to work. See package.json.
predeploy:
windows:
shell: pwsh
run: 'echo "VITE_API_BASE_URL=\"$env:API_BASE_URL\"" > .env.local ; echo "VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$env:APPLICATIONINSIGHTS_CONNECTION_STRING\"" >> .env.local ; npm run build; rm .env.local'
run: 'echo "VITE_API_BASE_URL=\"$env:API_BASE_URL\"" > .env.local ; echo "VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$env:APPLICATIONINSIGHTS_CONNECTION_STRING\"" >> .env.local'
posix:
shell: sh
run: 'echo VITE_API_BASE_URL=\"$API_BASE_URL\" > .env.local && echo VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$APPLICATIONINSIGHTS_CONNECTION_STRING\" >> .env.local && npm install && npm run build && rm .env.local'
run: 'echo VITE_API_BASE_URL=\"$API_BASE_URL\" > .env.local && echo VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$APPLICATIONINSIGHTS_CONNECTION_STRING\" >> .env.local'
postdeploy:
windows:
shell: pwsh
run: 'rm .env.local'
posix:
shell: sh
run: 'rm .env.local'
api:
project: ../../api/js
language: js
Expand Down
15 changes: 11 additions & 4 deletions templates/todo/projects/python-mongo-aca/.repo/bicep/azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ services:
language: js
host: containerapp
hooks:
# When azd runs package, the static-web-app-required .env-values (from azd env) are not visible to `npm run build`.
# This hook creates a temporary `.env.local` file for the build command. Vite will automatically use it during build.
# When azd runs package, the static-web-app-required azd-.env-values are not visible to `docker build`.
# This hook creates a temporary `.env.local` file for the build command. Vite will automatically use it during docker image creation.
# The expected/required values are mapped to the infrastructure outputs.
# .env.local is ignored by git, so it will not be committed if for any reason the hook does not remove it at the end.
# see: https://vitejs.dev/guide/env-and-mode
# Note: Notice that dotenv must be a project dependency for this to work. See package.json.
predeploy:
windows:
shell: pwsh
run: 'echo "VITE_API_BASE_URL=\"$env:API_BASE_URL\"" > .env.local ; echo "VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$env:APPLICATIONINSIGHTS_CONNECTION_STRING\"" >> .env.local ; npm run build; rm .env.local'
run: 'echo "VITE_API_BASE_URL=\"$env:API_BASE_URL\"" > .env.local ; echo "VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$env:APPLICATIONINSIGHTS_CONNECTION_STRING\"" >> .env.local'
posix:
shell: sh
run: 'echo VITE_API_BASE_URL=\"$API_BASE_URL\" > .env.local && echo VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$APPLICATIONINSIGHTS_CONNECTION_STRING\" >> .env.local && npm install && npm run build && rm .env.local'
run: 'echo VITE_API_BASE_URL=\"$API_BASE_URL\" > .env.local && echo VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$APPLICATIONINSIGHTS_CONNECTION_STRING\" >> .env.local'
postdeploy:
windows:
shell: pwsh
run: 'rm .env.local'
posix:
shell: sh
run: 'rm .env.local'
api:
project: ../../api/python
language: python
Expand Down

0 comments on commit 148a834

Please sign in to comment.