Compare commits

...

10 Commits

256 changed files with 81 additions and 53 deletions

View File

@ -1,29 +0,0 @@
name: Build & Deploy Docker Image
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: little-core-labs/get-git-tag@v3.0.1
id: tagName
with:
tagRegex: "v(.*)"
tagRegexGroup: 1
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build ./backend -t jhalitaksoy/mancala-backend:$GIT_TAG_NAME
- name: Push the Docker image
run: docker push jhalitaksoy/mancala-backend:$GIT_TAG_NAME

View File

@ -1,6 +1,6 @@
{
"name": "@mancala/backend",
"version": "0.4.5",
"version": "0.4.7",
"description": "",
"main": "index.js",
"scripts": {

9
apps/compose.yaml Normal file
View File

@ -0,0 +1,9 @@
services:
backend:
image: jhalitaksoy/mancala-backend:latest
ports:
- "5000:6000"
frontend:
image: jhalitaksoy/mancala-frontend:0.4.7
ports:
- "3000:3000"

25
apps/frontend/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM node:20-alpine3.19 AS build
ARG SERVER_ADDRESS WS_SERVER_ADDRESS
WORKDIR /app
COPY package.json ./
COPY yarn.lock ./
RUN yarn install
COPY . ./
RUN yarn build
FROM nginx:stable-alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

View File

@ -18,4 +18,10 @@ yarn dev
### Development Dependencies
This package depends on the local packages `@mancala/core` and `mancala.js`. Refer to their documentation for further instructions.
This package depends on the local packages `@mancala/core` and `mancala.js`. Refer to their documentation for further instructions.
### Docker Build
```bash
docker build --build-arg SERVER_ADDRESS=http://localhost:5000 --build-arg WS_SERVER_ADDRESS=http://localhost:5000 -t mancala-frontend .
```

View File

@ -0,0 +1,8 @@
server {
listen 3000;
location / {
root /usr/share/nginx/html/;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@mancala/frontend",
"version": "0.4.5",
"version": "0.4.7",
"description": "Mancala Game Frontend",
"scripts": {
"dev": "parcel src/index.html",

View File

@ -24,7 +24,7 @@ const context = initContext();
const MancalaApp: FunctionComponent = () => {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const [userKey, setUserKey] = useState<string | undefined>(undefined);
@ -38,6 +38,12 @@ const MancalaApp: FunctionComponent = () => {
const onThemeChange = (theme: Theme) => setTheme(theme);
React.useEffect(() => {
//@ts-ignore
const deviceLanguage = navigator.language || navigator.userLanguage;
i18n.changeLanguage(deviceLanguage === "tr-TR" ? "tr" : "en")
}, []);
const connectRTMT = (userKey: string) => {
const rtmt = context.rtmt as RTMTWS;
rtmt.on("error", onConnectionError);

View File

@ -0,0 +1,18 @@
export const isAlpha = true;
export type Server = {
serverAdress: string;
wsServerAdress: string;
};
export const LOCAL_SERVER_ADDRESS='http://localhost:5005';
export const LOCAL_WS_SERVER_ADDRESS='http://localhost:5005';
export const server: Server = {
//@ts-ignore
serverAdress: process.env.SERVER_ADDRESS ? `${process.env.SERVER_ADDRESS}` : LOCAL_SERVER_ADDRESS,
//@ts-ignore
wsServerAdress: process.env.WS_SERVER_ADDRESS ? `${process.env.WS_SERVER_ADDRESS}` : LOCAL_WS_SERVER_ADDRESS,
}
export const RTMT_WS_PING_INTERVAL = 1000, RTMT_WS_PING_INTERVAL_BUFFER_TIME = 2000;

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Some files were not shown because too many files have changed in this diff Show More