fix: correction to Docker files

This commit is contained in:
Riccardo
2023-08-30 20:53:42 +02:00
parent 0f1f9ec7d8
commit a36daaaec3
6 changed files with 28 additions and 16 deletions

17
.dockerignore Normal file
View File

@@ -0,0 +1,17 @@
# Exclude locally installed packages
node_modules/
# Exclude build files
.dockerignore
Dockerfile
# Exclude git history and configuration
.gitignore
# Exclude IDE configuration
.husky
.github
.nvmrc
.prettierrc
commitlint.config.js
jest.config.js

View File

@@ -1,9 +1,10 @@
# Development stage
FROM node:18-alpine3.18 as builder
FROM node:18 as builder
WORKDIR /app
COPY package*.json ./
COPY package*.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
@@ -17,10 +18,10 @@ RUN apt-get update && apt-get install -y openssl
WORKDIR /app
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/yarn.lock ./
COPY --from=builder /app/build ./build
COPY --from=builder /app/prisma ./prisma
RUN yarn install --production
RUN yarn install --frozen-lockfile --production
EXPOSE 3000

View File

@@ -5,13 +5,11 @@ services:
build:
context: ./
dockerfile: Dockerfile
image: backend_image
image: backend
container_name: backend
restart: unless-stopped
ports:
- '3000:3000'
volumes:
- .:/app
environment:
- PORT=3000
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/postgres

View File

@@ -1,5 +1,5 @@
{
"name": "node-with-typescript",
"name": "node-template-with-typescript",
"version": "1.0.0",
"description": "Backend with NodeJS in TypeScript",
"main": "src/index.ts",
@@ -7,10 +7,11 @@
"author": "riccardo.s@hey.com",
"license": "MIT",
"scripts": {
"start": "node build/index.js",
"dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts",
"build": "tsc",
"lint": "eslint --ext .ts . --fix",
"typecheck": "tsc",
"typecheck": "tsc --noEmit",
"format": "prettier --config .prettierrc 'src/**/*.ts' --write",
"test": "jest --runInBand",
"prepare": "husky install",

View File

@@ -2,8 +2,8 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
provider = "prisma-client-js"
// binaryTargets = ["native", "linux-arm64-openssl-3.0.x", "linux-arm64-openssl-1.1.x"]
}
datasource db {

View File

@@ -1939,11 +1939,6 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"
crypto@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/crypto/-/crypto-1.0.1.tgz#2af1b7cad8175d24c8a1b0778255794a21803037"
integrity sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==
dargs@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz"