-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
68 lines (43 loc) · 1.64 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
### base image
# Create an intermediate image for build speed with production dependencies
FROM node:16-alpine as base
RUN mkdir -p /home/wa-js-api-server && \
mkdir -p /home/wa-js-api-server/logs
WORKDIR /home/wa-js-api-server
ENV NODE_ENV=production
COPY .npmrc package.json package-lock.json LICENSE ./
RUN npm set-script prepare "" && \
npm install --production && \
npm cache clean --force
### build image
# Create an image to only build the package and copy to final image
FROM base as build
WORKDIR /home/wa-js-api-server
COPY .npmrc package.json package-lock.json ./
# install the devDependencies
RUN npm set-script prepare "" && \
npm install --production=false
COPY . .
RUN npm run build
### final image
FROM base
LABEL version="1.0.0" description="WPPConnectLinkPreview" maintainer="Alan Martines<[email protected]>"
WORKDIR /home/wa-js-api-server
COPY --from=build /home/wa-js-api-server/dist /home/wa-js-api-server/dist/
EXPOSE 8000/tcp
CMD [ "node", "--trace-warnings", "dist/server.js" ]
## Acessar bash do container
# docker exec -it <container id> /bin/sh
# docker exec -it <container id> /bin/bash
## Logs do container
# docker logs -f --tail 1000 WPPconnectLinkPreview
## Removendo todos os containers e imagens de uma só vez
# docker rm $(docker ps -qa)
## Removendo todas as imagens de uma só vez
# docker rmi $(docker images -aq)
## Removendo imagens
# docker rmi <REPOSITORY>
# docker rmi <IMAGE ID>
## Como obter o endereço IP de um contêiner Docker do host
# https://stack.desenvolvedor.expert/appendix/docker/rede.html
# docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <IMAGE ID>