Skip to content

Commit f8502ef

Browse files
committed
revert dockerfile, create custom for testing
1 parent 3c7be7d commit f8502ef

File tree

8 files changed

+234
-209
lines changed

8 files changed

+234
-209
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
.idea
4+

Dockerfile

+21-40
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,32 @@
1-
ARG THOR_VERSION=v2.1.5
1+
# Build thor in a stock Go builder container
2+
ARG THOR_VERSION=v2.1.6
23

3-
FROM vechain/thor:${THOR_VERSION} AS thor-builder
4+
FROM golang:1.22 AS builder
45

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
610

7-
# Install necessary packages
8-
RUN apk add --no-cache ca-certificates bash nodejs npm
11+
FROM ubuntu:24.04
912

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
2218

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
2521

22+
RUN git clone https://github.com/vechain/rosetta.git
2623
WORKDIR /usr/src/app/rosetta
24+
RUN git checkout master
25+
RUN npm ci && npm run build
2726

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
4828

29+
COPY --from=builder /go/thor/bin/thor /usr/src/app/
4930
EXPOSE 8080 8669 11235 11235/udp
5031

51-
ENTRYPOINT ["sh", "./start.sh"]
32+
ENTRYPOINT ["sh","./start.sh"]

src/common/checkSchema.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class CheckSchema {
2828
const schema = Joi.object({
2929
index:Joi.number().min(0),
3030
hash:Joi.string().length(66).regex(/^(-0x|0x)?[0-9a-f]*$/)
31-
}).or('index','hash');
31+
});
3232
const verify = schema.validate(blockIdentifier,{allowUnknown:true});
3333
return {result:verify.error == undefined,error:verify.error};
3434
}
@@ -52,4 +52,4 @@ export class CheckSchema {
5252
const verify = schema.validate(addr);
5353
return verify.error == undefined ? true : false;
5454
}
55-
}
55+
}

src/controllers/block.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ export class Block extends Router {
4040
revision = ctx.request.body.block_identifier.hash;
4141
}
4242

43-
if(revision == undefined){
44-
ConvertJSONResponeMiddleware.KnowErrorJSONResponce(ctx,getError(24,undefined));
45-
return;
46-
}
47-
4843
try {
4944
const block = await this.connex.thor.block(revision).get();
5045
if(block != null){
@@ -146,4 +141,4 @@ export class Block extends Router {
146141
private connex:ConnexPro;
147142
private verifyMiddleware:RequestInfoVerifyMiddleware;
148143
private transConverter:TransactionConverter;
149-
}
144+
}

0 commit comments

Comments
 (0)