Skip to content

Commit bc13b57

Browse files
committed
Add tor install from dojo docker
1 parent c8e25aa commit bc13b57

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

Dockerfile

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ COPY ./samourai-dojo/. "$APP_DIR"
1616
RUN cd "$APP_DIR" && \
1717
npm install --omit=dev --build-from-source=false
1818

19-
##### Tor build stage
19+
##### Tor build
2020

21-
FROM alpine:3.20 AS torproject
21+
FROM alpine:3.22 AS torproject
2222

2323
ENV TOR_GIT_URL=https://git.torproject.org/tor.git
2424
ENV TOR_VERSION=tor-0.4.8.16
@@ -43,9 +43,9 @@ RUN make -j 4 && make install
4343

4444
RUN cp /stage/etc/tor/torrc.sample /stage/.torrc
4545

46-
##### Soroban Go build stage
46+
##### Soroban build
4747

48-
FROM golang:1.22.8-alpine3.20 AS soroban-build
48+
FROM golang:1.23-alpine3.22 AS soroban-build
4949

5050
ENV SOROBAN_VERSION=0.4.1
5151
ENV SOROBAN_URL=https://github.com/Dojo-Open-Source-Project/soroban/archive/refs/tags/v$SOROBAN_VERSION.tar.gz
@@ -75,9 +75,10 @@ ENV APP_DIR=/home/node/app
7575
ENV SOROBAN_HOME=/home/soroban
7676

7777
RUN set -ex && \
78-
apk --no-cache add shadow bash && \
78+
apk --update --no-cache add ca-certificates bash && \
79+
apk --no-cache add shadow && \
7980
apk --no-cache add mariadb mariadb-client pwgen nginx yq curl netcat-openbsd && \
80-
apk --no-cache add openssl libevent zlib
81+
apk --no-cache add openssl libevent zlib runuser
8182

8283
### Node
8384

@@ -98,27 +99,36 @@ COPY ./samourai-dojo/db-scripts/2_update.sql /docker-entrypoint-initdb.d/2_updat
9899

99100
### Tor
100101

102+
ARG SOROBAN_TOR_LINUX_UID=1112
103+
ARG SOROBAN_TOR_LINUX_GID=1115
104+
101105
COPY --from=torproject /stage /usr/local
102106

107+
RUN addgroup -g ${SOROBAN_TOR_LINUX_GID} -S tor && \
108+
adduser --system --ingroup tor --uid ${SOROBAN_TOR_LINUX_UID} tor
109+
110+
RUN mkdir -p /var/lib/tor
111+
RUN chown tor:tor /var/lib/tor
112+
113+
RUN cp /usr/local/etc/tor/torrc.sample /home/tor/.torrc
114+
103115
### Soroban
104116

117+
ENV SOROBAN_HOME /home/soroban
118+
ARG SOROBAN_LINUX_UID=1111
119+
ARG SOROBAN_LINUX_GID=1114
120+
105121
COPY --from=soroban-build /stage/soroban-server /usr/local/bin
106122

107-
# Create soroban user and group
108-
RUN addgroup -g 1001 -S soroban && \
109-
adduser --system --ingroup soroban --uid 1001 soroban
123+
# Create Soroban group and user
124+
RUN addgroup -g ${SOROBAN_LINUX_GID} -S soroban && \
125+
adduser --system --ingroup soroban --uid ${SOROBAN_LINUX_UID} soroban
110126

111-
# Create Soroban data directory
127+
# Create data directory
112128
RUN mkdir "$SOROBAN_HOME/data" && \
113129
chown -h soroban:soroban "$SOROBAN_HOME/data"
114130

115-
# Copy Tor config for Soroban
116-
RUN cp /usr/local/etc/tor/torrc.sample /home/soroban/.torrc && \
117-
chown soroban:soroban /home/soroban/.torrc
118-
119-
# Copy Soroban scripts
120-
COPY --chown=soroban:soroban --chmod=754 ./samourai-dojo/docker/my-dojo/soroban/restart.sh /usr/local/bin/soroban-restart.sh
121-
COPY --chown=soroban:soroban --chmod=754 ./samourai-dojo/docker/my-dojo/soroban/healthcheck.sh /usr/local/bin/soroban-healthcheck.sh
131+
RUN cp /home/tor/.torrc /home/soroban/.torrc
122132

123133
### Nginx
124134

@@ -137,3 +147,4 @@ COPY --chmod=755 ./check-mysql.sh /usr/local/bin/
137147
COPY --chmod=755 ./check-pushtx.sh /usr/local/bin/
138148
COPY --chmod=755 ./check-soroban.sh /usr/local/bin/
139149
COPY --chmod=755 ./functions.sh /usr/local/bin/
150+
COPY --chmod=755 ./samourai-dojo/docker/my-dojo/soroban/restart.sh /usr/local/bin/soroban-restart.sh

0 commit comments

Comments
 (0)