diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..dc157ff --- /dev/null +++ b/.dockerignore @@ -0,0 +1,34 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.next +**/.cache +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose.y*ml +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +**/build +**/dist +LICENSE +README.md diff --git a/Dockerfile b/Dockerfile index 32f6a64..892ef52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,38 @@ -FROM node:18-alpine as base +# syntax=docker/dockerfile:1 -WORKDIR /home/node/app -COPY package.json ./ -RUN npm install -g npm-check-updates -RUN ncu -u -RUN npm install -COPY . ./ +# Comments are provided throughout this file to help you get started. +# If you need more help, visit the Dockerfile reference guide at +# https://docs.docker.com/go/dockerfile-reference/ -FROM base as production +# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 -ENV NODE_PATH=./build -RUN npm run build +ARG NODE_VERSION=18.19.1 + +FROM node:${NODE_VERSION}-alpine + +# Use production node environment by default. +ENV NODE_ENV production + + +WORKDIR /usr/src/app + +# Download dependencies as a separate step to take advantage of Docker's caching. +# Leverage a cache mount to /root/.yarn to speed up subsequent builds. +# Leverage a bind mounts to package.json and yarn.lock to avoid having to copy them into +# into this layer. +RUN --mount=type=bind,source=package.json,target=package.json \ + --mount=type=bind,source=yarn.lock,target=yarn.lock \ + --mount=type=cache,target=/root/.yarn \ + yarn install --production --frozen-lockfile + +# Run the application as a non-root user. +USER node + +# Copy the rest of the source files into the image. +COPY . . + +# Expose the port that the application listens on. +EXPOSE 3000 + +# Run the application. +CMD yarn start diff --git a/README.Docker.md b/README.Docker.md new file mode 100644 index 0000000..fa3048f --- /dev/null +++ b/README.Docker.md @@ -0,0 +1,22 @@ +### Building and running your application + +When you're ready, start your application by running: +`docker compose up --build`. + +Your application will be available at http://localhost:3000. + +### Deploying your application to the cloud + +First, build your image, e.g.: `docker build -t myapp .`. +If your cloud uses a different CPU architecture than your development +machine (e.g., you are on a Mac M1 and your cloud provider is amd64), +you'll want to build the image for that platform, e.g.: +`docker build --platform=linux/amd64 -t myapp .`. + +Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. + +Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) +docs for more detail on building and pushing. + +### References +* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 515baa8..416d6c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,51 @@ -version: "3.7" +# Comments are provided throughout this file to help you get started. +# If you need more help, visit the Docker Compose reference guide at +# https://docs.docker.com/go/compose-spec-reference/ + +# Here the instructions define your application as a service called "server". +# This service is built from the Dockerfile in the current directory. +# You can add other services your application may depend on here, such as a +# database or a cache. For examples, see the Awesome Compose repository: +# https://github.com/docker/awesome-compose services: - liveterm: + server: build: context: . - dockerfile: Dockerfile - target: base - expose: - - '3000' + environment: + NODE_ENV: production ports: - - '3000:3000' - volumes: - - ./src/:/home/node/app/src - command: npm run dev + - 3000:3000 + +# The commented out section below is an example of how to define a PostgreSQL +# database that your application can use. `depends_on` tells Docker Compose to +# start the database before your application. The `db-data` volume persists the +# database data between container restarts. The `db-password` secret is used +# to set the database password. You must create `db/password.txt` and add +# a password of your choosing to it before running `docker-compose up`. +# depends_on: +# db: +# condition: service_healthy +# db: +# image: postgres +# restart: always +# user: postgres +# secrets: +# - db-password +# volumes: +# - db-data:/var/lib/postgresql/data +# environment: +# - POSTGRES_DB=example +# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password +# expose: +# - 5432 +# healthcheck: +# test: [ "CMD", "pg_isready" ] +# interval: 10s +# timeout: 5s +# retries: 5 +# volumes: +# db-data: +# secrets: +# db-password: +# file: db/password.txt + diff --git a/src/utils/bin/commands.ts b/src/utils/bin/commands.ts index 67dcf36..d1e9815 100644 --- a/src/utils/bin/commands.ts +++ b/src/utils/bin/commands.ts @@ -47,8 +47,8 @@ export const cv = async (args: string[]): Promise => { export const donate = async (args: string[]): Promise => { return `thank you for your interest. here are the ways you can support my work: -- paypal -- patreon +- paypal +- patreon `; }; @@ -99,31 +99,31 @@ export const banner = (args?: string[]): string => { return ` - # - # - # KKKKKKKKK KKKKKKKMMMMMMMM MMMMMMMM SSSSSSSSSSSSSSS - # K:::::::K K:::::KM:::::::M M:::::::M SS:::::::::::::::S - # K:::::::K K:::::KM::::::::M M::::::::MS:::::SSSSSS::::::S - # K:::::::K K::::::KM:::::::::M M:::::::::MS:::::S SSSSSSS - # KK::::::K K:::::KKKM::::::::::M M::::::::::MS:::::S - # K:::::K K:::::K M:::::::::::M M:::::::::::MS:::::S - # K::::::K:::::K M:::::::M::::M M::::M:::::::M S::::SSSS - # K:::::::::::K M::::::M M::::M M::::M M::::::M SS::::::SSSSS - # K:::::::::::K M::::::M M::::M::::M M::::::M SSS::::::::SS - # K::::::K:::::K M::::::M M:::::::M M::::::M SSSSSS::::S - # K:::::K K:::::K M::::::M M:::::M M::::::M S:::::S - # KK::::::K K:::::KKKM::::::M MMMMM M::::::M S:::::S - # K:::::::K K::::::KM::::::M M::::::MSSSSSSS S:::::S - # K:::::::K K:::::KM::::::M M::::::MS::::::SSSSSS:::::S - # K:::::::K K:::::KM::::::M M::::::MS:::::::::::::::SS - # KKKKKKKKK KKKKKKKMMMMMMMM MMMMMMMM SSSSSSSSSSSSSSS - # - # - # - # - # - # - # + + + KKKKKKKKK KKKKKKKMMMMMMMM MMMMMMMM SSSSSSSSSSSSSSS + K:::::::K K:::::KM:::::::M M:::::::M SS:::::::::::::::S + K:::::::K K:::::KM::::::::M M::::::::MS:::::SSSSSS::::::S + K:::::::K K::::::KM:::::::::M M:::::::::MS:::::S SSSSSSS + KK::::::K K:::::KKKM::::::::::M M::::::::::MS:::::S + K:::::K K:::::K M:::::::::::M M:::::::::::MS:::::S + K::::::K:::::K M:::::::M::::M M::::M:::::::M S::::SSSS + K:::::::::::K M::::::M M::::M M::::M M::::::M SS::::::SSSSS + K:::::::::::K M::::::M M::::M::::M M::::::M SSS::::::::SS + K::::::K:::::K M::::::M M:::::::M M::::::M SSSSSS::::S + K:::::K K:::::K M::::::M M:::::M M::::::M S:::::S + KK::::::K K:::::KKKM::::::M MMMMM M::::::M S:::::S + K:::::::K K::::::KM::::::M M::::::MSSSSSSS S:::::S + K:::::::K K:::::KM::::::M M::::::MS::::::SSSSSS:::::S + K:::::::K K:::::KM::::::M M::::::MS:::::::::::::::SS + KKKKKKKKK KKKKKKKMMMMMMMM MMMMMMMM SSSSSSSSSSSSSSS + + + + + + +