Skip to content

Commit

Permalink
build: fix missing git
Browse files Browse the repository at this point in the history
  • Loading branch information
sarabveer committed Dec 26, 2023
1 parent c0fbdff commit e211729
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 53 deletions.
27 changes: 0 additions & 27 deletions .dockerignore

This file was deleted.

87 changes: 74 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
Expand All @@ -18,11 +21,12 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
Expand All @@ -38,15 +42,27 @@ build/Release
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand All @@ -56,17 +72,62 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# User-specific stuff:
.idea/
*.iml
.vscode/
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### App Output
build/
Expand Down
19 changes: 11 additions & 8 deletions docker/mariadb/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Multi-stage docker build. Builds data first, and then switches to pure MariaDB.

FROM mariadb:10 as generate

WORKDIR /usr/app

ENV KNEXFILE=./docker/mariadb/knexfile

# Install node
RUN apt update
RUN apt -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt -y install nodejs
ARG NODE_MAJOR=20
RUN apt-get update
RUN apt-get -y install ca-certificates curl gnupg git
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get -y install nodejs

# Copy and install dependencies
COPY ./package*.json ./
RUN npm ci --no-audit
RUN npm i mysql2 --no-audit
COPY ./package*.json .
RUN npm ci
RUN npm i mysql2

# Copy repo
COPY . .
Expand Down
8 changes: 5 additions & 3 deletions lib/build-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/* eslint-disable global-require,import/no-dynamic-require */

require( './string-colors' )
const appRoot = require( 'app-root-path' )
const createSchema = require( './schema' )
const memoize = require( 'memoizee' )
const omit = require( 'lodash/omit' )
Expand Down Expand Up @@ -38,7 +39,7 @@ const {
toUnicode,
} = require( 'gurmukhi-utils' )

const JSON_PATH = '../data'
const JSON_PATH = `${appRoot}/data`

/**
* Maps a list of JSON objects to only return the english name.
Expand Down Expand Up @@ -239,7 +240,7 @@ const importLines = async ( trx, sourcesFallback ) => {
compositionNames.map( async ( compositionName, compositionIndex ) => {
console.log( `Processing composition ${compositionName}` )

const compositionDir = `./data/${compositionName}`
const compositionDir = `${JSON_PATH}/${compositionName}`

if ( !existsSync( compositionDir ) ) { return [] }

Expand Down Expand Up @@ -485,8 +486,9 @@ const importBanis = async trx => {
const setGitRevision = async knex => {
console.log( '\nSetting git revision'.subheader )

console.log( JSON_PATH )
const commitSHA = require( 'child_process' )
.execSync( 'git rev-parse HEAD', { cwd: 'data' } )
.execSync( 'git rev-parse HEAD', { cwd: JSON_PATH } )
.toString()
.trim()

Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"homepage": "https://github.com/gurbaninow/database",
"dependencies": {
"anyid": "^1",
"app-root-path": "^3.1.0",
"better-sqlite3": "^9.2.0",
"colors": "^1",
"commander": "^11.1.0",
Expand All @@ -63,7 +64,6 @@
"memoizee": "^0.4.15",
"objection": "^3.1.3",
"recursive-copy": "^2.0.14",
"release-it": "^17",
"rimraf": "^5.0.5",
"snakecase-keys": "^5",
"string-similarity": "^4"
Expand All @@ -77,6 +77,7 @@
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-require-sort": "^1.3.0",
"husky": "^8.0.3",
"lint-staged": "^15.1.0"
"lint-staged": "^15.1.0",
"release-it": "^17"
}
}

0 comments on commit e211729

Please sign in to comment.