Skip to content

Commit d001be1

Browse files
authored
Merge branch 'master' into visualizedata
2 parents c5371a4 + 181ae80 commit d001be1

File tree

13 files changed

+22529
-12629
lines changed

13 files changed

+22529
-12629
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/node_modules
2+
3+
/build
4+
5+
.git
6+
7+
*.md
8+
9+
.gitignore

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
.env.development.local
1818
.env.test.local
1919
.env.production.local
20-
20+
.env
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*

.nginx/nginx.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
worker_processes 4;
2+
3+
events { worker_connections 1024; }
4+
5+
http {
6+
server {
7+
listen 80;
8+
root /usr/share/nginx/html;
9+
include /etc/nginx/mime.types;
10+
11+
location / {
12+
try_files $uri /index.html;
13+
}
14+
}
15+
}

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# stage1 as builder
2+
FROM node:16-alpine as builder
3+
4+
# copy the package.json to install dependencies
5+
COPY package.json package-lock.json ./
6+
7+
# Install the dependencies and make the folder
8+
RUN npm install && mkdir /react-ui && mv ./node_modules ./react-ui
9+
10+
WORKDIR /react-ui
11+
12+
COPY . .
13+
14+
# Build the project and copy the files
15+
RUN npm run build
16+
17+
18+
FROM nginx:1.20-alpine
19+
20+
#!/bin/sh
21+
22+
COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf
23+
24+
## Remove default nginx index page
25+
RUN rm -rf /usr/share/nginx/html/*
26+
27+
# Copy from the stage 1
28+
COPY --from=builder /react-ui/build /usr/share/nginx/html
29+
30+
EXPOSE 443 80
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened, closed]
9+
branches:
10+
- master
11+
12+
jobs:
13+
build_and_deploy_job:
14+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15+
runs-on: ubuntu-latest
16+
name: Build and Deploy Job
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
submodules: true
21+
- name: Build And Deploy
22+
id: builddeploy
23+
uses: Azure/static-web-apps-deploy@v1
24+
with:
25+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_SMOKE_0AB5F6610 }}
26+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
27+
action: "upload"
28+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
29+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
30+
app_location: "/" # App source code path
31+
api_location: "" # Api source code path - optional
32+
output_location: "build" # Built app content directory - optional
33+
###### End of Repository/Build Configurations ######
34+
35+
close_pull_request_job:
36+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
37+
runs-on: ubuntu-latest
38+
name: Close Pull Request Job
39+
steps:
40+
- name: Close Pull Request
41+
id: closepullrequest
42+
uses: Azure/static-web-apps-deploy@v1
43+
with:
44+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_SMOKE_0AB5F6610 }}
45+
action: "close"

deployments/azure/readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Alternate Deployment Methods
2+
This is a GitHub Action yml file that will deploy the current React web application to [Azure Static Web Apps](http://<link to doc>). It is placed here as there is no Azure account to tie it to just yet.
3+
4+
### Setup
5+
To set up an Azure Static Web App using GitHub, follow the directions highlighted in [this](https://docs.microsoft.com/en-us/azure/static-web-apps/get-started-portal?tabs=vanilla-javascript)
6+
documentation article.
7+
8+
1. Set up your static web app repository on Github
9+
2. Create an account on the Azure portal
10+
3. Using the Azure portal, select "create a new project" option.
11+
4. Fill in the details of your project, and link your Github account to Azure.
12+
5. Select "create" after which the build .yml files will be created in your Github repository and
13+
begin deployment using Github Actions. The yml file in this folder is an example of the file that
14+
will get generated.

0 commit comments

Comments
 (0)