Skip to content

Commit 7fb0781

Browse files
Nguyen Thaihoangdat
Nguyen Thai
authored andcommitted
Added compose file for quick local setup
Simplified the Dockerfile Added compose docs to the README
1 parent fb14e79 commit 7fb0781

File tree

4 files changed

+60
-21
lines changed

4 files changed

+60
-21
lines changed

Diff for: Dockerfile

+3-18
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ WORKDIR /app
2323
COPY . .
2424

2525
# Precompile tmail flutter
26-
RUN cd core \
27-
&& flutter pub get \
28-
&& cd ../model \
29-
&& flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs \
30-
&& cd ../contact \
31-
&& flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs \
32-
&& cd ../rule_filter \
33-
&& flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs \
34-
&& cd ../forward \
35-
&& flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs \
36-
&& cd ../fcm \
37-
&& flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs \
38-
&& cd .. \
39-
&& flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs \
40-
&& flutter pub get && flutter pub run intl_generator:extract_to_arb --output-dir=./lib/l10n lib/main/localizations/app_localizations.dart \
41-
&& flutter pub get && flutter pub run intl_generator:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/main/localizations/app_localizations.dart lib/l10n/intl*.arb \
42-
&& flutter build web --profile
26+
RUN bash prebuild.sh && flutter build web --profile
4327

4428
# Stage 2 - Create the run-time image
4529
FROM nginx:mainline
@@ -51,4 +35,5 @@ COPY --from=build-env /app/build/web /usr/share/nginx/html
5135
EXPOSE 80
5236

5337
# Before stating NGinx, re-zip all the content to ensure customizations are propagated
54-
CMD gzip -k -r /usr/share/nginx/html/ && nginx -g 'daemon off;'
38+
RUN gzip -k -f -r /usr/share/nginx/html/
39+
CMD ["nginx", "-g", "daemon off;"]

Diff for: README.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,33 @@ No we do not plan to support such extensions, that are currently not standardize
154154
docker run -d -ti -p 8080:80 --mount type=bind,source="$(pwd)"/env.dev.file,target=/usr/share/nginx/html/assets/env.file --name web tmail-web:latest
155155
```
156156

157-
Then go to http://localhost:8080 and you should be able to login against your JMAP backend using the Team Mail web-app.
157+
Then go to http://localhost:8080 and you should be able to login against your JMAP backend using the TMail web-app.
158+
159+
#### Using the docker-compose file
160+
161+
We also include a [docker-compose.yaml](docker-compose.yaml) file so you can get a testing environment up quickly. This use our [tmail-backend](https://hub.docker.com/r/linagora/tmail-backend) image for the JMAP server.
162+
163+
Here are the steps to setup:
164+
165+
1. Generate JWT keys for `tmail-backend`:
166+
```bash
167+
openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:4096 -out jwt_privatekey
168+
openssl rsa -in jwt_privatekey -pubout -out jwt_publickey
169+
```
170+
2. Edit the `env.file` and set `SERVER_URL` to `http://localhost/` (with the trailing slash)
171+
3. Run `docker compose up -d` to bring up both the frontend and the backend.
172+
4. Run `docker compose exec tmail-backend /root/provisioning/provisioning.sh` to provision some demo accounts (you don't have to let it run all the way).
173+
5. The TMail web-app should be available at `http://localhost:8080`. The credentials for demo accounts are:
174+
```
175+
User: alice@localhost
176+
Password: aliceSecret
177+
178+
User: bob@localhost
179+
Password: bobSecret
180+
181+
User: empty@localhost
182+
Password: emptrySecret
183+
```
158184

159185
#### More configurations for Team Mail web
160186

Diff for: docker-compose.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "3"
2+
3+
services:
4+
tmail-frontend:
5+
image: linagora/tmail-web:master
6+
container_name: tmail-frontend
7+
ports:
8+
- "8080:80"
9+
volumes:
10+
- ./env.file:/usr/share/nginx/html/assets/env.file
11+
networks:
12+
- tmail
13+
depends_on:
14+
- tmail-backend
15+
16+
tmail-backend:
17+
image: linagora/tmail-backend:memory-branch-master
18+
container_name: tmail-backend
19+
volumes:
20+
- ./jwt_publickey:/root/conf/jwt_publickey
21+
- ./jwt_privatekey:/root/conf/jwt_privatekey
22+
ports:
23+
- "80:80"
24+
networks:
25+
- tmail
26+
27+
networks:
28+
tmail:

Diff for: env.file

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SERVER_URL=http://localhost
1+
SERVER_URL=http://localhost/
22
DOMAIN_REDIRECT_URL=http://localhost:3000
33
WEB_OIDC_CLIENT_ID=teammail-web
4-
APP_GRID_AVAILABLE=supported
4+
APP_GRID_AVAILABLE=supported

0 commit comments

Comments
 (0)