Skip to content

Commit 7353792

Browse files
committed
refactor: optimize dockerfile
1 parent f412794 commit 7353792

File tree

8 files changed

+12
-430
lines changed

8 files changed

+12
-430
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ SERVER_URL=http://localhost:8080
55

66
SENTRY_DSN=
77

8+
TZ=America/Sao_Paulo
9+
810
# Cors - * for all or set separate by commas - ex.: 'yourdomain1.com, yourdomain2.com'
911
CORS_ORIGIN=*
1012
CORS_METHODS=GET,POST,PUT,DELETE

Dockerfile

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,34 @@
11
FROM node:20-alpine AS builder
22

3-
RUN apk update && \
4-
apk add git wget curl bash
5-
6-
LABEL version="2.1.2-lite" description="Api to control whatsapp features through http requests."
7-
LABEL maintainer="Davidson Gomes" git="https://github.com/EvolutionAPI"
8-
LABEL contact="[email protected]"
3+
RUN apk add git wget curl bash
94

105
WORKDIR /evolution
116

127
COPY ./package.json ./tsconfig.json ./
13-
148
RUN npm install --omit=dev
159

10+
RUN rm -rf /var/cache/apk/*
11+
1612
COPY ./src ./src
1713
COPY ./public ./public
1814
COPY ./prisma ./prisma
19-
COPY ./manager ./manager
2015
COPY ./.env.example ./.env
2116
COPY ./runWithProvider.js ./
2217
COPY ./tsup.config.ts ./
23-
2418
COPY ./Docker ./Docker
2519

26-
RUN chmod +x ./Docker/scripts/* && dos2unix ./Docker/scripts/*
27-
28-
RUN ./Docker/scripts/generate_database.sh
29-
30-
RUN npm run build
20+
RUN chmod +x ./Docker/scripts/* && dos2unix ./Docker/scripts/* && \
21+
./Docker/scripts/generate_database.sh && \
22+
npm run build
3123

3224
FROM node:20-alpine AS final
3325

34-
RUN apk update && \
35-
apk add tzdata bash
36-
37-
ENV TZ=America/Sao_Paulo
38-
3926
WORKDIR /evolution
4027

41-
COPY --from=builder /evolution/package.json ./package.json
42-
COPY --from=builder /evolution/package-lock.json ./package-lock.json
43-
44-
COPY --from=builder /evolution/node_modules ./node_modules
45-
COPY --from=builder /evolution/dist ./dist
46-
COPY --from=builder /evolution/prisma ./prisma
47-
COPY --from=builder /evolution/manager ./manager
48-
COPY --from=builder /evolution/public ./public
49-
COPY --from=builder /evolution/.env ./.env
50-
COPY --from=builder /evolution/Docker ./Docker
51-
COPY --from=builder /evolution/runWithProvider.js ./runWithProvider.js
52-
COPY --from=builder /evolution/tsup.config.ts ./tsup.config.ts
28+
COPY --from=builder /evolution ./
5329

5430
ENV DOCKER_ENV=true
5531

5632
EXPOSE 8080
5733

58-
ENTRYPOINT ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ]
34+
ENTRYPOINT ["/bin/bash", "-c", "npm run start:prod" ]
-17.2 KB
Binary file not shown.

manager/dist/assets/index-DNOCacL_.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

manager/dist/assets/index-Do1bGWiz.js

Lines changed: 0 additions & 381 deletions
This file was deleted.

manager/dist/index.html

Lines changed: 0 additions & 14 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
],
3939
"author": {
4040
"name": "Davidson Gomes",
41-
"email": "contato@atendai.com"
41+
"email": "contato@evolution-api.com"
4242
},
4343
"license": "Apache-2.0",
4444
"bugs": {

runWithProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { execSync } = require('child_process');
33
dotenv.config();
44

55
const { DATABASE_PROVIDER } = process.env;
6-
const databaseProviderDefault = DATABASE_PROVIDER ?? "postgresql"
6+
const databaseProviderDefault = DATABASE_PROVIDER ?? 'postgresql';
77

88
if (!DATABASE_PROVIDER) {
99
console.error(`DATABASE_PROVIDER is not set in the .env file, using default: ${databaseProviderDefault}`);

0 commit comments

Comments
 (0)