Skip to content

Commit

Permalink
Merge pull request #3 from gt-sse-center/kate/docker_file
Browse files Browse the repository at this point in the history
working dockerfile and working cypress test run on push
  • Loading branch information
krachwal committed Nov 20, 2023
2 parents e7c19fc + dca1b73 commit b228516
Show file tree
Hide file tree
Showing 5 changed files with 1,442 additions and 3,179 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
Dockerfile*
react_frontend/node_modules
19 changes: 19 additions & 0 deletions .github/workflows/run-frontend-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Commit Workflow
on:
push
jobs:
run-cypress-tests:
runs-on: ubuntu-latest
name: Run Cypress Tests
container:
image: cypress/browsers:node18.12.0-chrome107
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Cypress
uses: cypress-io/github-action@v6
with:
working-directory: ./react-frontend
build: npm run build
start: npm start

33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# syntax=docker/dockerfile:1
# This docker container runs the web portal
# Slim Linux image
FROM alpine:latest
LABEL description="Ramanujan Machine Web Portal"

# set working directory
WORKDIR /srv/ramanujan-machine-portal

# install node
RUN apk update && apk add nodejs npm

COPY ./react-frontend/package.json ./
COPY ./react-frontend/package-lock.json ./
COPY ./react-frontend/tsconfig.json ./

# install node package dependencies
RUN npm ci

# Copy project files
COPY ./react-frontend/src ./src
COPY ./react-frontend/public ./public

# Build project
RUN npm run build

# remove dev dependencies
RUN npm prune --production
# RUN npm install -g serve

EXPOSE 3000
#ENTRYPOINT ["serve", "-s", "build"]
ENTRYPOINT ["npm", "run", "start"]
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# ramanujan-machine-web
# Ramanujan Machine Web Portal

## Run with Docker
To run the web portal using the Dockerfile:

`docker build . -t ramanujan-machine-web-portal:latest`

`docker run -p 8080:3000 ramanujan-machine-web-portal:latest`

Note that the first port is the port you can access via your web browser, e.g. `http://localhost:8080` is where you would be able to interact with the app given the above configuration. You can change `8080` to whatever port you wish, but the application runs on port `3000` inside the container.

## Run with Docker
Refer to [React Frontend README](./react-frontend/README.md) to run locally.
Loading

0 comments on commit b228516

Please sign in to comment.