fix docker again
This commit is contained in:
parent
851d2d683f
commit
9c114a0ef0
3 changed files with 20 additions and 16 deletions
29
Dockerfile
29
Dockerfile
|
@ -1,21 +1,28 @@
|
|||
FROM node:16
|
||||
|
||||
FROM node:16 as backend-ts-compiler
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm i
|
||||
|
||||
COPY tsconfig*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM node:16 as frontend-compiler
|
||||
WORKDIR /app/frontend
|
||||
|
||||
RUN npm i
|
||||
|
||||
COPY --from=backend-ts-compiler /app/frontend/package*.json ./
|
||||
RUN npm install
|
||||
COPY --from=backend-ts-compiler /app/frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
FROM node:16 as strip-dev-deps
|
||||
WORKDIR /app
|
||||
COPY --from=backend-ts-compiler /app/package*.json ./
|
||||
COPY --from=backend-ts-compiler /app/dist ./
|
||||
RUN npm install --only=production
|
||||
|
||||
CMD [ "/bin/sh", "-c", "npm run ream && npm run start" ]
|
||||
FROM node:16
|
||||
WORKDIR /app
|
||||
COPY --from=strip-dev-deps /app ./
|
||||
COPY --from=frontend-compiler /app/frontend/public ./frontend/public
|
||||
RUN echo "JWT_SECRET=$(openssl rand -base64 256 | tr -d '\n')" > .env
|
||||
USER node
|
||||
CMD [ "/bin/sh", "-c", "node index.js db-init && node index.js" ]
|
||||
|
|
|
@ -12,10 +12,7 @@ services:
|
|||
build: .
|
||||
ports:
|
||||
- "5002:3000"
|
||||
volumes:
|
||||
- .:/app
|
||||
environment:
|
||||
- JWT_SECRET=__jwtsecretgoeshere__
|
||||
- PGUSER=waffle
|
||||
- PGHOST=waffle-postgres
|
||||
- PGPASSWORD=supersecretpassword11
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
"target": "esnext",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"outDir": "./dist"
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue