-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
102 lines (76 loc) · 2.83 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
FROM ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782
LABEL repository="https://github.com/junobuild/juno-docker"
LABEL homepage="https://juno.build"
LABEL maintainer="David Dal Busco <[email protected]>"
ENV TZ=UTC
# Install required tools
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \
jq \
curl \
liblmdb-dev \
libunwind-dev \
netcat-traditional \
ca-certificates \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install NodeJS
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
RUN apt-get install nodejs -y
# Create and use a user instead of using root
RUN useradd -ms /bin/bash apprunner
USER apprunner
# Define working directories
WORKDIR /juno
# Create a volume to persist state when the container is stopped and restarted
RUN mkdir -p /juno/.juno/replica
RUN mkdir /juno/.juno/cli
VOLUME /juno/.juno
# Exposed ports
ENV PORT=5987
ENV ADMIN_PORT=5999
ENV CONSOLE_PORT=5866
# Environment variables where files are downloaded and executed
ENV TARGET_DIR=/juno/target
RUN echo "export TARGET_DIR=${TARGET_DIR}" >> ./.bashrc
# Environment variables for the server
RUN echo "export STATE_REPLICA_DIR=/juno/.juno/replica" >> ./.bashrc
RUN echo "export REPLICA_PORT=8000" >> ./.bashrc
RUN echo "export STATE_CLI_DIR=/juno/.juno/cli" >> ./.bashrc
# Environment variables for using the Juno source repo
ENV JUNO_MAIN_DIR=${TARGET_DIR}/juno-main
RUN echo "export JUNO_MAIN_DIR=${JUNO_MAIN_DIR}" >> ./.bashrc
# Arguments to build the CLI - either satellite or console
ARG CLI_BUILD=satellite
RUN echo "export CLI_BUILD=${CLI_BUILD}" >> ./.bashrc
# Copy list of resources and scripts to download them
COPY --chown=apprunner:apprunner ./docker/download ./docker/download
COPY --chown=apprunner:apprunner ./ic.json ./ic.json
COPY --chown=apprunner:apprunner ./modules.json ./modules.json
# Download required artifacts and sources
RUN ./docker/download/init
# Install Rust and Cargo in apprunner home
ENV RUSTUP_HOME=/home/apprunner/.rustup \
CARGO_HOME=/home/apprunner/.cargo \
PATH=/home/apprunner/.cargo/bin:$PATH
# Copy WASM setup scripts
COPY --chown=apprunner:apprunner ./kit/setup ./kit/setup
# Install tools for building WASM within the container
RUN ./kit/setup/bootstrap
# Copy WASM build resources
COPY --chown=apprunner:apprunner ./kit/build ./kit/build
# Build Sputnik dependencies
RUN ./kit/build/build-deps
# Copy server resources for running replica and cli
COPY --chown=apprunner:apprunner ./docker/server ./docker/server
# Copy CLI resources
COPY --chown=apprunner:apprunner ./cli ./cli
# Install Console UI
RUN ./docker/server/console/setup
# Install and build CLI
RUN ./docker/server/cli/setup
# Make downloaded files executable
RUN chmod +x ${TARGET_DIR}/*
ENTRYPOINT ["./docker/server/app"]
EXPOSE ${PORT}
EXPOSE ${ADMIN_PORT}
EXPOSE ${CONSOLE_PORT}