Skip to content

Commit

Permalink
initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
henryjw committed May 3, 2024
1 parent 0c76b2c commit 1b515f0
Show file tree
Hide file tree
Showing 7 changed files with 5,757 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Build
on:
push:

jobs:
Build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: Build

- name: Cache
uses: actions/cache@v3
id: cache
with:
path: |
pnpm
key: cache-${{ hashFiles('pnpm-lock.yaml') }}

- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-map: |
{
"pnpm": "/pnpm"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Build
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
file: Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.idea
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:21-slim AS base

ENV PNPM_HOME="/pnpm"

RUN corepack enable

# Copy your application code
WORKDIR /app
COPY . .

RUN pnpm install --frozen-lockfile

# Use a smaller Node.js image for the final image
FROM node:alpine AS prod

# Set working directory
WORKDIR /app

# Copy only the production dependencies and application code
COPY --from=base /app/node_modules /app/node_modules
COPY --from=base /app .

CMD ["npm", "start"]

1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('Hello World!')
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "multifunctional-nodejs-app",
"version": "1.0.0",
"description": "A multifunctional Node.js application",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@aws-sdk/core": "^3.567.0",
"express": "^4.19.2",
"node-gyp": "^10.1.0",
"s3-zip": "^3.3.0",
"unzipper": "^0.11.4"
},
"devDependencies": {
"eslint": "^9.1.1",
"jest": "^29.7.0"
}
}
Loading

0 comments on commit 1b515f0

Please sign in to comment.