forked from ytgov/internal-data-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from icefoganalytics/issue-3/add-minimal-docker…
…-docker-compose-node-setup Add Minimal Docker/Docker Compose Node Setup
- Loading branch information
Showing
47 changed files
with
8,062 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
api/node_modules | ||
api/dist | ||
web/node_modules | ||
web/dist | ||
dist | ||
npm-debug.log | ||
node_modules | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
env: | ||
browser: true | ||
es2021: true | ||
node: true | ||
extends: | ||
- prettier | ||
overrides: [] | ||
parserOptions: | ||
ecmaVersion: latest | ||
sourceType: module | ||
rules: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Build and Push | ||
|
||
on: | ||
push: | ||
branches: [main, test] | ||
# Publish semver tags as releases. | ||
tags: ["v*.*.*", "v*.*.*.*"] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Generate release tag | ||
id: generate_release_tag | ||
uses: amitsingh-007/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_prefix: "v" | ||
tag_template: "yyyy.mm.dd.i" | ||
|
||
- name: Extract Git Commit Hash | ||
id: git_commit_hash | ||
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ steps.generate_release_tag.outputs.next_release_tag }} | ||
build-args: | | ||
RELEASE_TAG=${{ steps.generate_release_tag.outputs.next_release_tag }} | ||
GIT_COMMIT_HASH=${{ steps.git_commit_hash.outputs.commit_hash }} | ||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.generate_release_tag.outputs.next_release_tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories + files | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
.env.production | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
app | ||
|
||
# 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 | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
db/sapassword.env | ||
.env.development | ||
|
||
# DB Data | ||
db/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# .prettierrc or .prettierrc.yaml | ||
$schema: "https://json.schemastore.org/prettierrc" | ||
embeddedLanguageFormatting: "auto" | ||
trailingComma: "es5" | ||
tabWidth: 2 | ||
semi: false | ||
singleQuote: false | ||
singleAttributePerLine: true | ||
useTabs: false | ||
printWidth: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nodejs 20.10.0 | ||
ruby 3.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
"vue.vscode-typescript-vue-plugin", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"jebbs.plantuml" | ||
], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"eslint.workingDirectories": ["./api", "./web"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Stage 0 - base node customizations | ||
FROM node:20.10.0-alpine3.19 as base-node | ||
|
||
RUN npm install -g [email protected] | ||
|
||
# Stage 1 - api build - requires development environment because typescript | ||
FROM base-node as api-build-stage | ||
|
||
ENV NODE_ENV=development | ||
|
||
WORKDIR /usr/src/api | ||
|
||
COPY api/package*.json ./ | ||
COPY api/tsconfig*.json ./ | ||
RUN npm install | ||
|
||
COPY api ./ | ||
|
||
RUN npm run build | ||
|
||
# Stage 2 - web build - requires development environment to install vue-cli-service | ||
# FROM base-node as web-build-stage | ||
|
||
# ENV NODE_ENV=development | ||
|
||
# WORKDIR /usr/src/web | ||
|
||
# COPY web/package*.json ./ | ||
# COPY web/tsconfig*.json ./ | ||
# COPY web/babel.config.js ./ | ||
# RUN npm install | ||
|
||
# COPY web ./ | ||
|
||
# Switching to production mode for build environment. | ||
ENV NODE_ENV=production | ||
RUN npm run build | ||
|
||
# Stage 3 - production setup | ||
FROM base-node | ||
|
||
ARG RELEASE_TAG | ||
ARG GIT_COMMIT_HASH | ||
|
||
ENV RELEASE_TAG=${RELEASE_TAG} | ||
ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH} | ||
|
||
ENV NODE_ENV=production | ||
USER node | ||
|
||
WORKDIR /home/node/app | ||
RUN chown -R node:node /home/node/app | ||
|
||
COPY --from=api-build-stage --chown=node:node /usr/src/api/package*.json ./ | ||
RUN npm install && npm cache clean --force --loglevel=error | ||
|
||
COPY --from=api-build-stage --chown=node:node /usr/src/api/dist/src ./dist | ||
# Replace with web build once it's ready | ||
COPY --from=api-build-stage --chown=node:node /usr/src/api/src/web ./dist/web | ||
# COPY --from=web-build-stage --chown=node:node /usr/src/web/dist ./dist/web | ||
|
||
RUN echo "RELEASE_TAG=${RELEASE_TAG}" >> VERSION | ||
RUN echo "GIT_COMMIT_HASH=${GIT_COMMIT_HASH}" >> VERSION | ||
|
||
EXPOSE 3000 | ||
|
||
COPY --from=api-build-stage --chown=node:node /usr/src/api/bin/boot-app.sh ./bin/ | ||
RUN chmod +x ./bin/boot-app.sh | ||
|
||
ENTRYPOINT ["./bin/boot-app.sh"] |
Oops, something went wrong.