|
1 |
| -ARG THOR_VERSION=v2.1.5 |
| 1 | +# Build thor in a stock Go builder container |
| 2 | +ARG THOR_VERSION=v2.1.6 |
2 | 3 |
|
3 |
| -FROM vechain/thor:${THOR_VERSION} AS thor-builder |
| 4 | +FROM golang:1.22 AS builder |
4 | 5 |
|
5 |
| -FROM alpine:3.20 AS node-buider |
| 6 | +WORKDIR /go/thor |
| 7 | +RUN git clone https://github.com/vechain/thor.git /go/thor |
| 8 | +RUN git checkout ${THOR_VERSION} |
| 9 | +RUN make all |
6 | 10 |
|
7 |
| -# Install necessary packages |
8 |
| -RUN apk add --no-cache ca-certificates bash nodejs npm |
| 11 | +FROM ubuntu:24.04 |
9 | 12 |
|
10 |
| -# Copy and build rosetta |
11 |
| -WORKDIR /usr/src/app/rosetta |
12 |
| -COPY package.json package-lock.json tsconfig.json ./ |
13 |
| -RUN npm ci --ignore-scripts \ |
14 |
| - && cd node_modules/@pzzh/solc \ |
15 |
| - && npm run postinstall |
16 |
| -COPY src src |
17 |
| -RUN npm run build |
18 |
| - |
19 |
| -FROM alpine:3.20 |
20 |
| - |
21 |
| -RUN apk add --no-cache ca-certificates nodejs npm |
| 13 | +WORKDIR /data |
| 14 | +WORKDIR /usr/src/app |
| 15 | +RUN apt-get update |
| 16 | +RUN apt-get install -y git |
| 17 | +RUN apt-get install -y curl |
22 | 18 |
|
23 |
| -# Install pm2 globally |
24 |
| -RUN npm install -g pm2 |
| 19 | +RUN curl -sL https://deb.nodesource.com/setup_18.x | bash |
| 20 | +RUN apt-get install -y nodejs |
25 | 21 |
|
| 22 | +RUN git clone https://github.com/vechain/rosetta.git |
26 | 23 | WORKDIR /usr/src/app/rosetta
|
| 24 | +RUN git checkout master |
| 25 | +RUN npm ci && npm run build |
27 | 26 |
|
28 |
| -COPY --from=thor-builder /usr/local/bin/thor /usr/src/app |
29 |
| -COPY --from=node-buider /usr/src/app/rosetta/dist/index.js /usr/src/app/rosetta/dist/index.js |
30 |
| - |
31 |
| -COPY process_online.json process_offline.json start.sh ./ |
32 |
| -COPY rosetta-cli-conf rosetta-cli-conf |
33 |
| -COPY config config |
34 |
| - |
35 |
| -# Create a non-root user |
36 |
| -RUN adduser -D -s /bin/ash thor |
37 |
| - |
38 |
| -# Create /data/logs directory and set permissions for the thor user |
39 |
| -RUN mkdir -p /data/logs && chown -R thor:thor /data/logs |
40 |
| - |
41 |
| -# Prepare PM2 directories with correct permissions |
42 |
| -RUN mkdir -p /home/thor/.pm2/logs /home/thor/.pm2/pids && \ |
43 |
| - chown -R thor:thor /home/thor/.pm2 |
44 |
| - |
45 |
| -ENV PM2_HOME=/home/thor/.pm2 |
46 |
| - |
47 |
| -USER thor |
| 27 | +RUN npm install -g pm2 |
48 | 28 |
|
| 29 | +COPY --from=builder /go/thor/bin/thor /usr/src/app/ |
49 | 30 | EXPOSE 8080 8669 11235 11235/udp
|
50 | 31 |
|
51 |
| -ENTRYPOINT ["sh", "./start.sh"] |
| 32 | +ENTRYPOINT ["sh","./start.sh"] |
0 commit comments