Skip to content

Commit

Permalink
Merge pull request #78 from uwwebservices/eval
Browse files Browse the repository at this point in the history
Eval to Master
  • Loading branch information
GaryLu-UW authored Jan 5, 2022
2 parents 716dcea + 9934742 commit 27aed05
Show file tree
Hide file tree
Showing 52 changed files with 17,650 additions and 14,022 deletions.
7 changes: 5 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [ "env", "react-app" ],
"presets": [ "@babel/preset-env", "@babel/preset-react" ],
"plugins": [
["module-resolver", {
"alias": {
Expand All @@ -9,6 +9,9 @@
"Assets": "./src/backend/assets",
"Routes": "./src/backend/routes"
}
}]
}],
["@babel/plugin-proposal-class-properties"],
["@babel/plugin-transform-runtime"],
["@babel/plugin-transform-spread", { "loose": true }]
]
}
56 changes: 28 additions & 28 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Based on Microsoft's Node 10 example
# To fully customize the contents of this image, use the following Dockerfile instead:
# https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/javascript-node-10/.devcontainer/Dockerfile
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node@sha256:567574eac6192c01ea2c725573ecfe6f4873384097caca222de1568231518924

RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# install git iproute2, required tools installed
&& apt-get install -y \
git \
vim \
openssh-client \
less \
curl \
procps \
unzip \
apt-transport-https \
ca-certificates \
gnupg-agent \
software-properties-common \
lsb-release 2>&1 \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
# Based on Microsoft's Node 10 example
# To fully customize the contents of this image, use the following Dockerfile instead:
# https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/javascript-node-10/.devcontainer/Dockerfile
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-14

RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# install git iproute2, required tools installed
&& apt-get install -y \
git \
vim \
openssh-client \
less \
curl \
procps \
unzip \
apt-transport-https \
ca-certificates \
gnupg-agent \
software-properties-common \
lsb-release 2>&1 \
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
76 changes: 44 additions & 32 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/javascript-node-10
{
"name": "UWER",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker"
],

"runArgs": [
"-p",
"1111:1111",
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/node/.ssh-localhost:ro",
"-v",
"${env:HOME}${env:USERPROFILE}/.aws:/node/.aws-localhost:ro"
],

"postCreateCommand": "mkdir -p $HOME/.ssh && cp -r /node/.ssh-localhost/* $HOME/.ssh && chmod 700 $HOME/.ssh && chmod 600 $HOME/.ssh/* && mkdir -p $HOME/.aws && cp -r /node/.aws-localhost/* $HOME/.aws && chmod 700 $HOME/.aws && chmod 600 $HOME/.aws/*",

// Uncomment to connect as a non-root user. See https://aka.ms/node-remote/containers/non-root.
"remoteUser": "node"
}
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/javascript-node-10
{
"name": "UWER",
"dockerFile": "Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker",
"donjayamanne.githistory"
],

"runArgs": [
"-p",
"1111:1111",
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/node/.ssh-localhost:ro",
"-v",
"${env:HOME}${env:USERPROFILE}/.aws:/node/.aws-localhost:ro"
],

// Enable file watching within the container
"containerEnv": {
"CHOKIDAR_USEPOLLING": "true"
},

// Mount a named volume to speed up installing/building node packages
"mounts": [
"source=uwer-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume"
],

// Copy ssh & aws keys; setup permissions on the named volume in node_modules
"postCreateCommand": "mkdir -p $HOME/.ssh && cp -r /node/.ssh-localhost/* $HOME/.ssh && chmod 700 $HOME/.ssh && chmod 600 $HOME/.ssh/* && mkdir -p $HOME/.aws && cp -r /node/.aws-localhost/* $HOME/.aws && chmod 700 $HOME/.aws && chmod 600 $HOME/.aws/* && sudo chown node node_modules",

// Uncomment to connect as a non-root user. See https://aka.ms/node-remote/containers/non-root.
"remoteUser": "node"
}
5 changes: 0 additions & 5 deletions .editorconfig

This file was deleted.

28 changes: 25 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
{
"globals": { "Promise": true, "process": true },
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 9,
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
"jsx": true
}
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"rules": {
"no-debugger": "off",
"no-console": "off",
"no-unused-vars": "warn",
"react/prop-types": "warn"
},
"settings": {
"react": {
"version": "detect"
}
}
}
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"endOfLine": "lf",
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 240,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
26 changes: 11 additions & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"restart": true,
"protocol": "inspector"
}
]
{
"version": "0.2.0",
"configurations": [
{
"type": "node-terminal",
"name": "Run Script: dev",
"request": "launch",
"command": "npm run dev",
"cwd": "${workspaceFolder}"
}
]
}
73 changes: 36 additions & 37 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
# ---- Base Node ----
FROM node:10.4.1-alpine AS base
RUN apk add --no-cache nodejs-current tini
WORKDIR /www
# Set tini as entrypoint
ENTRYPOINT ["/sbin/tini", "--"]
# copy project file
COPY package.json .

# ---- Dependencies ----
FROM base AS dependencies
# install git to pull down ews-api-lib
RUN apk update && apk upgrade && apk add --no-cache git
# install node packages
RUN npm set progress=false && npm config set depth 0
RUN npm install --only=production
# copy production node_modules aside
RUN cp -R node_modules prod_node_modules
# install ALL node_modules, including 'devDependencies'
RUN npm install
COPY . .
# build the project
RUN npm run build

# ---- Release ----
FROM base AS release
# copy production node_modules
COPY --from=dependencies /www/prod_node_modules /www/node_modules

# copy only the things we need for production
COPY --from=dependencies /www/dist /www/dist
COPY --from=dependencies /www/config_base /www/config_base

# sp-key.pem is injected by Azure DevOps, copy it to a better location
COPY sp-key.pem /www/config/sp-key.pem

EXPOSE 1111
# ---- Base Node ----
FROM node:14.11.0-alpine AS base
RUN apk add --no-cache nodejs-current tini
WORKDIR /www
# Set tini as entrypoint
ENTRYPOINT ["/sbin/tini", "--"]
# copy project file
COPY package.json .

# ---- Dependencies ----
FROM base AS dependencies
# install git to pull down ews-api-lib
RUN apk update && apk upgrade && apk add --no-cache git
# install node packages
RUN npm set progress=false && npm config set depth 0
RUN npm install --only=production
# copy production node_modules aside
RUN cp -R node_modules prod_node_modules
# install ALL node_modules, including 'devDependencies'
RUN npm install
COPY . .
# build the project
RUN npm run build

# ---- Release ----
FROM base AS release
# copy production node_modules
COPY --from=dependencies /www/prod_node_modules /www/node_modules

# copy only the things we need for production
COPY --from=dependencies /www/dist /www/dist

# sp-key.pem is injected by Azure DevOps, copy it to a better location
COPY sp-key.pem /www/config/sp-key.pem

EXPOSE 1111
CMD npm start
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@

## Build Status

master: [![Build Status](https://dev.azure.com/uwit-ews/WS/_apis/build/status/uwwebservices.idcard-webapp-poc?branchName=master)](https://dev.azure.com/uwit-ews/WS/_build/latest?definitionId=50&branchName=master)
master: [![Build Status](https://dev.azure.com/uwit-ews/WS/_apis/build/status/uwwebservices.UWER?branchName=master)](https://dev.azure.com/uwit-ews/WS/_build/latest?definitionId=50&branchName=master)

develop: [![Build Status](https://dev.azure.com/uwit-ews/WS/_apis/build/status/uwwebservices.idcard-webapp-poc?branchName=develop)](https://dev.azure.com/uwit-ews/WS/_build/latest?definitionId=50&branchName=develop)
develop: [![Build Status](https://dev.azure.com/uwit-ews/WS/_apis/build/status/uwwebservices.UWER?branchName=develop)](https://dev.azure.com/uwit-ews/WS/_build/latest?definitionId=50&branchName=develop)

Documentation: [Client Wiki](https://wiki.cac.washington.edu/pages/viewpage.action?pageId=92391281)

## Beta Service Availability

UWIT is expoloring offering UWER as a service to UW departments/groups and is currently in a closed beta. See the [wiki](https://wiki.cac.washington.edu/pages/viewpage.action?pageId=92391281) if you would like to be involved in beta testing the offering, or use this repository to deploy your own instance (no support provided).
UWIT is exploring offering UWER as a service to UW departments/groups and is currently in a closed beta. See the [wiki](https://wiki.cac.washington.edu/pages/viewpage.action?pageId=92391281) if you would like to be involved in beta testing the offering, or use this repository to deploy your own instance (no support provided).


## Development

In order to develop with VSCode in containers, you should download the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.

**To run locally**
1. Clone repo
2. Open repo in container, vscode should notify you asking if you want to open in the container.
3. Once open in the container run `npm install`, then `npm run dev`.

**To debug**
1. Run via Debug tab, use config `Run Script: dev` from `.vscode\launch.json`
Loading

0 comments on commit 27aed05

Please sign in to comment.