-
Notifications
You must be signed in to change notification settings - Fork 30
/
Dockerfile
116 lines (93 loc) · 3.92 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Start with docker-tangerine-base-image, which provides the core Tangerine apps.
FROM tangerine/docker-tangerine-base-image:v3.8.0
RUN git config --global url."https://".insteadOf git://
# Never ask for confirmations
ENV DEBIAN_FRONTEND noninteractive
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# Install global node dependencies
# set unsafe-perm true allows it to work on ARM Macs(M1)
RUN npm config set unsafe-perm true
RUN npm install -g uuid couchdb-wedge
RUN npm config set unsafe-perm false
# Install helpful JSON utility.
RUN apt-get update && apt-get install -y jq
# Install mysql integration dependencies.
RUN apt update && apt install -y default-mysql-server
# T_USER1 is the username of the first user you will log in as. It is also the super user that has all permissions.
ENV T_USER1 user1
ENV T_USER1_PASSWORD password
# T_ADMIN is the admin user for your database. Make sure to change this so the outside world does not have access.
ENV T_ADMIN admin
ENV T_PASS password
# T_HOST_NAME is the URL without protocol (like http://) you will be accessing your Tangerine server at.
ENV T_HOST_NAME 127.0.0.1
# If you have set up SSL on your server, you must change this to "https".
ENV T_PROTOCOL http
# Set to "development" for live code reload of editor and client.
ENV T_RUN_MODE production
# Install online-survey-app.
ADD online-survey-app/package.json /tangerine/online-survey-app/package.json
RUN cd /tangerine/online-survey-app/ && \
npm install
# Install server.
ADD ./server/package.json /tangerine/server/package.json
RUN cd /tangerine/server && \
npm install
# Install editor.
ADD ./editor/package.json /tangerine/editor/package.json
RUN cd /tangerine/editor && \
npm install
# Install client.
ADD client/package.json /tangerine/client/package.json
RUN cd /tangerine/client/ && \
npm install
# Install PWA tools.
ADD client/pwa-tools/service-worker-generator/package.json /tangerine/client/pwa-tools/service-worker-generator/package.json
ADD client/pwa-tools/service-worker-generator/workbox-cli-config.js /tangerine/client/pwa-tools/service-worker-generator/workbox-cli-config.js
RUN cd /tangerine/client/pwa-tools/service-worker-generator && \
npm install
ADD client/pwa-tools/updater-app/package.json /tangerine/client/pwa-tools/updater-app/package.json
ADD client/pwa-tools/updater-app/bower.json /tangerine/client/pwa-tools/updater-app/bower.json
RUN cd /tangerine/client/pwa-tools/updater-app && \
npm install && \
./node_modules/.bin/bower install --allow-root
# Build online-survey-app.
ADD online-survey-app /tangerine/online-survey-app/
RUN cd /tangerine/online-survey-app && \
./node_modules/.bin/ng build --base-href "./"
# build client.
ADD client /tangerine/client
RUN cd /tangerine/client && \
./node_modules/.bin/ng build --base-href "./"
# Build editor.
ADD editor /tangerine/editor
RUN cd /tangerine/editor && ./node_modules/.bin/ng build --base-href "./"
RUN cd /tangerine/editor && ./node_modules/.bin/workbox generate:sw
# Build PWA tools.
RUN cd /tangerine/client/pwa-tools/updater-app && \
npm run build && \
cp logo.svg build/default/
# Package release sources for APK and PWA.
RUN cd /tangerine/client && \
cp -r dist/tangerine-client builds/apk/www/shell && \
cp -r pwa-tools/updater-app/build/default builds/pwa && \
mkdir builds/pwa/release-uuid && \
cp -r dist/tangerine-client builds/pwa/release-uuid/app
# Modify links to javascript modules because they won't work in an APK (Angular 8 work-around)
RUN sed -i 's/type="module"/type="text\/javascript"/g' /tangerine/client/builds/apk/www/shell/index.html
# Add the rest of server.
ADD server /tangerine/server
# Link up global commands.
RUN cd /tangerine/server && \
npm link
#
# Wrap up
#
ADD ./ /tangerine
RUN mkdir /csv
RUN mkdir /groups
RUN echo {} > /paid-worker-state.json
EXPOSE 80
ENTRYPOINT cd /tangerine/server/ && npm start
## Used for testing...
#CMD ["/bin/bash"]