-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (56 loc) · 2.07 KB
/
Dockerfile
File metadata and controls
75 lines (56 loc) · 2.07 KB
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
FROM node:18-bookworm
ARG NODE_SNAP=false
RUN apt-get update && apt-get install -y dos2unix
# Change working directory
WORKDIR /usr/src/app
# Clone FUXA repository
RUN git clone https://github.com/frangoteam/FUXA.git
# Install build dependencies for node-odbc
RUN apt-get update && apt-get install -y build-essential unixodbc unixodbc-dev
# Convert the script to Unix format and make it executable
RUN dos2unix FUXA/odbc/install_odbc_drivers.sh && chmod +x FUXA/odbc/install_odbc_drivers.sh
WORKDIR /usr/src/app/FUXA/odbc
RUN ./install_odbc_drivers.sh
# Change working directory
WORKDIR /usr/src/app
# Copy odbcinst.ini to /etc
RUN cp FUXA/odbc/odbcinst.ini /etc/odbcinst.ini
# Install Fuxa server
WORKDIR /usr/src/app/FUXA/server
# More tolerant npm config
ENV NODE_OPTIONS=--dns-result-order=ipv4first
RUN npm config set registry https://registry.npmjs.org/ \
&& npm config set fetch-retries 8 \
&& npm config set fetch-retry-factor 2 \
&& npm config set fetch-retry-mintimeout 30000 \
&& npm config set fetch-retry-maxtimeout 300000 \
&& npm config set audit false \
&& npm config set fund false
# Retry loop con backoff + timeout alto
RUN bash -lc '\
for i in 1 2 3 4 5 6 7 8; do \
echo "npm install - attempt $i/8"; \
npm install --no-audit --no-fund --prefer-offline --network-timeout=600000 && exit 0; \
echo "Failed, wait $((10*i))s and try again..."; \
sleep $((10*i)); \
done; \
echo "npm install failed after 8 attempts"; \
exit 1'
# Install options snap7
RUN if [ "$NODE_SNAP" = "true" ]; then \
npm install node-snap7; \
fi
# Workaround for sqlite3 https://stackoverflow.com/questions/71894884/sqlite3-err-dlopen-failed-version-glibc-2-29-not-found
RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev && \
apt-get autoremove -yqq --purge && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
npm install --build-from-source --sqlite=/usr/bin sqlite3
# Add project files
ADD . /usr/src/app/FUXA
# Set working directory
WORKDIR /usr/src/app/FUXA/server
# Expose port
EXPOSE 1881
# Start the server
CMD [ "npm", "start" ]