Multi-stage build, compose yml

This commit is contained in:
DarkCat09 2023-08-28 12:34:48 +04:00
parent 99934ac3c7
commit dcf6e565c2
No known key found for this signature in database
GPG Key ID: 0A26CD5B3345D6E3
3 changed files with 21 additions and 13 deletions

View File

@ -1,16 +1,12 @@
FROM node:18-alpine
FROM node:18-alpine as build
WORKDIR /app
COPY package*.json .
RUN npm install
COPY . .
RUN npm install
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
CMD ["npm", "start"]

View File

@ -37,6 +37,6 @@ npm run start
### Docker
```bash
sudo docker build -t txtdot/txtdot:latest .
sudo docker run --network host -d txtdot/txtdot:latest
docker compose build
docker compose up -d
```

12
docker-compose.yml Normal file
View 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