Multi-stage build, compose yml
This commit is contained in:
parent
99934ac3c7
commit
dcf6e565c2
18
Dockerfile
18
Dockerfile
@ -1,16 +1,12 @@
|
|||||||
FROM node:18-alpine
|
FROM node:18-alpine as build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json .
|
|
||||||
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN npm install
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
ENV PORT=8080
|
FROM node:18-alpine as run
|
||||||
|
WORKDIR /app
|
||||||
|
COPY /app/dist /app/package*.json . --from=build
|
||||||
|
RUN npm install --omit=dev
|
||||||
|
CMD npm start
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
|
||||||
|
@ -37,6 +37,6 @@ npm run start
|
|||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo docker build -t txtdot/txtdot:latest .
|
docker compose build
|
||||||
sudo docker run --network host -d txtdot/txtdot:latest
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
txtdot:
|
||||||
|
image: darkcat09/txtdot:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
network_mode: host
|
||||||
|
environment:
|
||||||
|
- HOST=127.0.0.1
|
||||||
|
- PORT=8080
|
||||||
|
- REVERSE_PROXY=true
|
||||||
|
# env_file: .env
|
Loading…
x
Reference in New Issue
Block a user