Skip to content
Merged
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
24 changes: 24 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Create and publish container
on:
release:
types: [published]
workflow_dispatch:
jobs:
build_container:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out Git repository
uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
- name: Build image
run: docker buildx build . --tag ghcr.io/studyphoenix/frontend --build-arg GIT_REF="$( git rev-parse HEAD )"
- name: Login to registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Publish to GitHub Container Registry
run: |
docker push ghcr.io/studyphoenix/frontend
22 changes: 22 additions & 0 deletions .github/workflows/update-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update data types
on:
workflow_dispatch:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
run_eslint:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out Git repository
uses: actions/checkout@v6
with:
ref: ${{ env.BRANCH_NAME }}
persist-credentials: true
- name: Generate types
run: ./generate-types.yml ci
- name: Push changes back to repository
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "chore: updated data types for API [skip ci]"
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:25-alpine3.21 AS build

ARG GIT_REF="studyphoenix"

# Frontend Build stage
WORKDIR /usr/src/build

ENV VITE_GIT_REF="${GIT_REF}"

COPY . /usr/src/build

RUN npm i
RUN npm run build

# Build final image
FROM nginx AS prod
COPY --from=build /usr/src/build/dist /usr/share/nginx/html
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
5 changes: 5 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ services:
restart: on-failure
ports:
- 8080:8080
environment:
DATA_DIR: /data
BACKEND_URL: http://localhost:8080
FRONTEND_URL: http://localhost:8081
DEFAULT_REDIRECT: http://localhost:8081
volumes:
- ./backend-data:/data
6 changes: 5 additions & 1 deletion generate-types.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash

if [[ $1 != "" ]]; then
set -e

if [[ $1 == "ci" ]]; then
npx --yes swagger-typescript-api@13.13.0 generate --path https://raw.githubusercontent.com/studyphoenix/backend/refs/heads/main/docs/swagger.json -o ./src/ts/types -n api.d.ts --no-client
elif [[ $1 != "" ]]; then
npx swagger-typescript-api@13.13.0 generate --path http://$1:8080/swagger/doc.json -o ./src/ts/types -n api.d.ts --no-client
else
npx swagger-typescript-api@13.13.0 generate --path https://raw.githubusercontent.com/studyphoenix/backend/refs/heads/main/docs/swagger.json -o ./src/ts/types -n api.d.ts --no-client
Expand Down
16 changes: 16 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
listen 3000;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
}

error_page 404 /index.html;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Binary file added public/alticon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading