Make runnable through docker

Add Dockerfile, compose.
Add .gitignore
Force usage of yarn.
This commit is contained in:
Jacob Caban-Tomski
2022-09-27 18:05:20 -06:00
parent 429f7eea95
commit cd00add0a9
9 changed files with 1784 additions and 9270 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git

36
.gitignore vendored Normal file
View File

@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

57
Dockerfile Normal file
View File

@@ -0,0 +1,57 @@
# 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.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
else echo "Lockfile not found." && exit 1; \
fi
# Rebuild the source code only when needed
FROM node:18-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN yarn build
# If using npm comment out above and use below instead
# RUN npm run 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
COPY --from=builder /app/public ./public
# 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/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]

View File

@@ -1,3 +1,5 @@
# bls-wallet-website
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
Reading from, and writing to, the chain is managed in `pages/demo.js`. To select local, Rinkeby or Goerli testnets, comment in/out the relevant config options.
@@ -7,25 +9,25 @@ Reading from, and writing to, the chain is managed in `pages/demo.js`. To select
First, install any relevant packages:
```bash
npm install
```
Sometimes, react-reveal can be a bit temperamental after the first npm install. It's not great practice but you can fix this with:
```bash
npm install --force
yarn
```
Once packages are installed, run the development server:
```bash
npm run dev
# or
yarn dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
### Docker
With `docker-compose` installed:
```bash
docker-compose up --build
```
## Learn More
To learn more about Next.js, take a look at the following resources:
@@ -34,5 +36,3 @@ To learn more about Next.js, take a look at the following resources:
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
# bls-wallet-website

8
docker-compose.yml Normal file
View File

@@ -0,0 +1,8 @@
version: '3'
services:
bls-wallet-website:
build:
context: .
ports:
- 3000:3000

View File

@@ -2,6 +2,7 @@
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
output: 'standalone',
}
module.exports = nextConfig

7653
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,9 @@
"name": "bls-wallet-website",
"version": "0.1.0",
"private": true,
"engines": {
"yarn": ">=1.0.0"
},
"scripts": {
"dev": "next dev",
"build": "next build",

3267
yarn.lock

File diff suppressed because it is too large Load Diff