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
16 changes: 15 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
PORT=1377
EXTEND_ESLINT=true
BROWSER=none
REACT_APP_BUILD_TYPE=development
REACT_APP_BUILD_TYPE=production
REACT_APP_FIREBASE_API_KEY=[your-api-key]
REACT_APP_FIREBASE_AUTH_DOMAIN=[projId].firebaseapp.com
REACT_APP_FIREBASE_DATABASE_URL=https://[projId].firebaseio.com
REACT_APP_FIREBASE_PROJECT_ID=[projId]
REACT_APP_FIREBASE_STORAGE_BUCKET=[projId].appspot.com
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=[messagingSenderId]
REACT_APP_FIREBASE_APP_ID=[appId]
REACT_APP_FIREBASE_MEASUREMENT_ID=[measurementId]
REACT_APP_MIDDLEWARE_URL=https://di2iygvxtg.execute-api.us-west-1.amazonaws.com/prod
REACT_APP_DYNAMIC_HINT_URL=https://oatutor-backend.herokuapp.com/get_hint
ENABLE_FIREBASE= true
DO_LOG_DATA= true
DO_LOG_MOUSE_DATA= true
AB_TEST_MODE= true
40 changes: 40 additions & 0 deletions .github/workflows/deploy-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Create and publish a Docker image
on:
push:
branches: ['main']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value={{date 'YYYYMMDD-HHmmss'}}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:lts-alpine AS build

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

WORKDIR /app/src/tools

RUN npm install

FROM nginx:alpine AS prod

COPY --from=build /app/build /usr/share/nginx/html

COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 80

CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
26 changes: 26 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
http {

include mime.types;

set_real_ip_from 0.0.0.0/0;
real_ip_recursive on;
real_ip_header X-Forward-For;
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;

location / {
try_files $uri /index.html;
}

error_page 404 /index.html;
}



}

events {}
Loading