-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from DIPSAS/takeover
New version of Hello open dips
- Loading branch information
Showing
87 changed files
with
18,139 additions
and
28,799 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/.next | ||
**/.cache | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose.y*ml | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
**/build | ||
**/dist | ||
LICENSE | ||
README.md |
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,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,53 +1,34 @@ | ||
name: Azure Static Web Apps CI/CD | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
env: | ||
APP_LOCATION: "/" # location of your client code | ||
API_LOCATION: "api" # location of your api source code - optional | ||
APP_ARTIFACT_LOCATION: "dist" # location of client code build output | ||
AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing deployment token for your static web app | ||
|
||
permissions: | ||
contents: read | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_and_deploy_job: | ||
environment: | ||
name: Production | ||
url: https://hello.open.dips.no | ||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
pull-requests: write # for Azure/static-web-apps-deploy to comment on PRs | ||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
name: Build and Deploy | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- name: Set custom hostname for static web app | ||
id: sethostname | ||
uses: azure/CLI@v1 | ||
with: | ||
inlineScript: | | ||
az staticwebapp hostname set \ | ||
--hostname hello.open.dips.no \ | ||
--name hello-open-dips \ | ||
--no-wait | ||
- name: Build And Deploy | ||
id: builddeploy | ||
uses: Azure/static-web-apps-deploy@v1 | ||
with: | ||
azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing api token for app | ||
action: "upload" | ||
app_location: ${{ env.APP_LOCATION }} | ||
api_location: ${{ env.API_LOCATION }} | ||
app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }} | ||
env: | ||
VITE_DIPS_SUBSCRIPTION_KEY: '${{ secrets.VITE_DIPS_SUBSCRIPTION_KEY }}' | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
|
||
- name: Build and push Docker image | ||
run: | | ||
az login --service-principal --username ${{ secrets.AZURE_CLIENT_ID }} --password ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }} | ||
az acr login --name ${{ secrets.ACR_NAME }} | ||
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/hello-bff:latest . | ||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/hello-bff:latest | ||
- name: Azure CLI script | ||
uses: azure/CLI@v1 | ||
with: | ||
inlineScript: | | ||
az login --service-principal --username ${{ secrets.AZURE_CLIENT_ID }} --password ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }} | ||
az webapp config container set --name ${{ secrets.WEBAPP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --docker-custom-image-name ${{ secrets.ACR_LOGIN_SERVER }}/hello-bff:latest | ||
az webapp restart --name ${{ secrets.WEBAPP_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --verbose |
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
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,72 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/go/dockerfile-reference/ | ||
|
||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 | ||
|
||
ARG NODE_VERSION=20.14.0 | ||
|
||
################################################################################ | ||
# Use node image for base image for all stages. | ||
FROM node:${NODE_VERSION}-alpine as base | ||
|
||
# Set working directory for all build stages. | ||
WORKDIR /usr/src/app | ||
|
||
|
||
################################################################################ | ||
# Create a stage for installing production dependecies. | ||
FROM base as deps | ||
|
||
# Download dependencies as a separate step to take advantage of Docker's caching. | ||
# Leverage a cache mount to /root/.npm to speed up subsequent builds. | ||
# Leverage bind mounts to package.json and package-lock.json to avoid having to copy them | ||
# into this layer. | ||
RUN --mount=type=bind,source=package.json,target=package.json \ | ||
--mount=type=bind,source=package-lock.json,target=package-lock.json \ | ||
--mount=type=cache,target=/root/.npm \ | ||
npm ci --omit=dev | ||
|
||
################################################################################ | ||
# Create a stage for building the application. | ||
FROM deps as build | ||
|
||
# Download additional development dependencies before building, as some projects require | ||
# "devDependencies" to be installed to build. If you don't need this, remove this step. | ||
RUN --mount=type=bind,source=package.json,target=package.json \ | ||
--mount=type=bind,source=package-lock.json,target=package-lock.json \ | ||
--mount=type=cache,target=/root/.npm \ | ||
npm ci | ||
|
||
# Copy the rest of the source files into the image. | ||
COPY . . | ||
# Run the build script. | ||
RUN npm run build | ||
|
||
################################################################################ | ||
# Create a new stage to run the application with minimal runtime dependencies | ||
# where the necessary files are copied from the build stage. | ||
FROM base as final | ||
|
||
# Use production node environment by default. | ||
ENV NODE_ENV production | ||
|
||
# Run the application as a non-root user. | ||
USER node | ||
|
||
# Copy package.json so that package manager commands can be used. | ||
COPY package.json . | ||
|
||
# Copy the production dependencies from the deps stage and also | ||
# the built application from the build stage into the image. | ||
COPY --from=deps /usr/src/app/node_modules ./node_modules | ||
COPY --from=build /usr/src/app/.next ./.next | ||
|
||
|
||
# Expose the port that the application listens on. | ||
EXPOSE 3000 | ||
|
||
# Run the application. | ||
CMD npm start |
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,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
export default nextConfig; |
Oops, something went wrong.