Skip to content

Commit

Permalink
fix: add structure + some common libs + ide config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Sep 20, 2022
1 parent f28d4ed commit 4771c51
Show file tree
Hide file tree
Showing 17 changed files with 274 additions and 2,387 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cypress
cypress.json
.github
.husky
.next
doc
node_modules
scripts
README.md
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"printWidth": 120,
"singleQuote": true,
"jsxBracketSameLine": false,
"semi": false,
"quoteProps": "consistent",
"useTabs": true,
"tabWidth": 4,
"trailingComma": "none"
}
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Install dependencies only when needed
FROM node:18-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
WORKDIR /app
COPY package.json yarn.lock ./
COPY . .
RUN yarn --frozen-lockfile


# Rebuild the source code only when needed
FROM node:18-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/src ./src
COPY . .
RUN yarn build

# Production image, copy all the files and run next
FROM node:18-alpine AS runner
WORKDIR /app

ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/ ./.next/

USER nextjs

EXPOSE 3000

CMD ["yarn", "start"]
56 changes: 56 additions & 0 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from "react";
import Link from "next/link";
import { useRouter } from "next/router";

const Header: React.FC = () => {
const router = useRouter();
const isActive: (pathname: string) => boolean = (pathname) =>
router.pathname === pathname;

let left = (
<div className="left">
<Link href="/">
<a className="bold" data-active={isActive("/")}>
Feed
</a>
</Link>
<style jsx>{`
.bold {
font-weight: bold;
}
a {
text-decoration: none;
color: #000;
display: inline-block;
}
.left a[data-active="true"] {
color: gray;
}
a + a {
margin-left: 1rem;
}
`}</style>
</div>
);

let right = null;

return (
<nav>
{left}
{right}
<style jsx>{`
nav {
display: flex;
padding: 2rem;
align-items: center;
}
`}</style>
</nav>
);
};

export default Header;
33 changes: 0 additions & 33 deletions components/Post.tsx

This file was deleted.

16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.9'

services:
vesting:
image: explorer-fe
ports:
- '80:3000'
environment:
- NEXT_PUBLIC_ENDPOINT='http://159.223.36.174:1317'
- NEXT_PUBLIC_RPC='http://167.71.207.84:8545'
- NEXT_PUBLIC_CHAINID=11115
- NEXT_PUBLIC_COSMOS_CHAINID='astra_11115-1'
restart: unless-stopped
logging:
options:
max-size: 10m
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
Loading

0 comments on commit 4771c51

Please sign in to comment.