Skip to content

Commit

Permalink
Merge pull request #4 from frontend-park-mail-ru/NM-2
Browse files Browse the repository at this point in the history
NM-2: core spa logic
  • Loading branch information
IlayMorozoff authored Sep 30, 2024
2 parents 0ab02fd + 8e476c4 commit baca7f0
Show file tree
Hide file tree
Showing 56 changed files with 4,845 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import globals from "globals";
import pluginJs from "@eslint/js";


export default [
{
languageOptions: {
globals: {
...globals.browser,
Handlebars: "readonly"
}
}
},
pluginJs.configs.recommended,
];
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
pull_request:
push:
branches:
- main
- develop

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
statuses: write

steps:
- name: Check out code into directory
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Clean install
id: install
run: npm ci

- name: Run linter
id: super-linter
uses: super-linter/super-linter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORE_GITIGNORED_FILES: true
DEFAULT_BRANCH: main
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_ALL_CODEBASE: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
.idea/
.vscode/
.DS_Store

*.precompiled.js
65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ENV_FILE = ./docker/.env
include $(ENV_FILE)

DOCKER_COMPOSE_PATH = ./docker/docker-compose.yaml

# use `gawk` on mac os
AWK := awk
ifeq ($(shell uname -s), Darwin)
AWK = gawk
ifeq (, $(shell which gawk 2> /dev/null))
$(error "gawk not found")
endif
endif

################################################################################
# Miscellaneous
################################################################################

.PHONY: help
## (default) Show help page.
help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|awk -F --- -v n=$$(tput cols) -v i=29 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n\n";}'

################################################################################
# Containers
################################################################################

.PHONY: docker-build
## Build docker container static server.
docker-build:
@docker compose -f $(DOCKER_COMPOSE_PATH) --env-file $(ENV_FILE) build

.PHONY: docker-start
## Start docker compose containers (all by default).
## Format: `docker-start [compose=<docker-compose-service>]`.
## Example: `docker-start`, `docker-stop compose=postgres`.
docker-start:
@docker compose -f $(DOCKER_COMPOSE_PATH) --env-file $(ENV_FILE) up -d $(compose)

.PHONY: docker-stop
## Stop docker compose containers (all by default).
## Format: `docker-stop [compose=<docker-compose-service>]`.
## Example: `docker-stop`, `docker-stop compose=postgres`.
docker-stop:
@docker compose -f $(DOCKER_COMPOSE_PATH) stop $(compose)

.PHONY: docker-ash
## Run `ash` in docker container of static server.
docker-ash:
@docker exec -it $(SERVICE_NAME) /bin/ash

.PHONY: docker-clean
## Remove containers, networks, volumes, and images created by `make docker-start`.
docker-clean:
@docker compose -f $(DOCKER_COMPOSE_PATH) down

.PHONY: build-image
## Build docker image of frontend static server with name.
build-image:
@docker build -f docker/Dockerfile --platform linux/amd64 -t daronenko/$(SERVICE_NAME)-frontend:$(VERSION) .

.PHONY: push-image
## Push docker image of frontend static server to the docker hub.
push-image:
@docker push daronenko/$(SERVICE_NAME)-frontend:$(VERSION)
3 changes: 3 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SERVICE_NAME=novamusic
VERSION=v0.3
PORT=3000
12 changes: 12 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:20-alpine

WORKDIR /service

COPY package.json ./
RUN npm install

COPY . .

EXPOSE 3000

CMD [ "npm", "run", "start" ]
11 changes: 11 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
novamusic-frontend:
image: daronenko/novamusic-frontend:${VERSION}
container_name: novamusic-frontend
build:
dockerfile: docker/Dockerfile
context: ..
env_file: .env
ports:
- 80:${PORT}
restart: on-failure
Loading

0 comments on commit baca7f0

Please sign in to comment.