Compare commits
10 Commits
340fde01a1
...
9c42f867e9
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c42f867e9 | |||
| 72aa95ca97 | |||
| 5d4ce2799c | |||
| 0c96056f84 | |||
| 313dd3d549 | |||
| 9dedc31626 | |||
| c916eef54e | |||
| 734417b0a6 | |||
| 7860f9aac4 | |||
| 7d407db1ef |
29
.github/workflows/build-and-deploy.yaml
vendored
@ -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
|
||||
@ -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
@ -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
@ -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;"]
|
||||
@ -19,3 +19,9 @@ yarn dev
|
||||
### Development Dependencies
|
||||
|
||||
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 .
|
||||
```
|
||||
8
apps/frontend/nginx/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
@ -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",
|
||||
@ -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);
|
||||
18
apps/frontend/src/const/config.ts
Normal 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;
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |