Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions docker/data-restore/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
FROM rust:1.67
WORKDIR /usr/src/zksync

RUN apt update && apt install wget openssl libssl-dev pkg-config npm curl libpq5 libpq-dev lsb-release -y
# PostgreSQL Apt Repository is used to install the compatible psql version.

# Create the file repository configuration:
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
# Update the package lists:
RUN apt update
RUN apt install postgresql-12 -y
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash
RUN apt install nodejs -y
RUN npm install -g yarn
FROM rust:1.67 AS builder

ENV ZKSYNC_HOME=/usr/src/zksync
WORKDIR $ZKSYNC_HOME

RUN apt update && apt install -y wget openssl libssl-dev pkg-config npm curl libpq5 libpq-dev lsb-release \
&& sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt update && apt install -y postgresql-12 \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash \
&& apt install -y nodejs \
&& npm install -g yarn

RUN cargo install diesel_cli --no-default-features --features postgres

# Copy workspace
COPY . .

RUN cargo build --release --bin zksync_data_restore

# Copy configuration files for data restore.
FROM debian:bullseye

ENV ZKSYNC_HOME=/usr/src/zksync

RUN apt update && apt install -y libpq5 openssl curl && apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --from=builder $ZKSYNC_HOME/target/release/zksync_data_restore $ZKSYNC_HOME/bin/
COPY docker/exit-tool/configs /usr/src/configs
COPY docker/data-restore/data-restore-entry.sh /bin/

# Setup the environment
ENV ZKSYNC_HOME=/usr/src/zksync
ENV PATH="${ZKSYNC_HOME}/bin:${PATH}"
ENV CONFIG_PATH=/usr/src/configs
ENV PG_DUMP_PATH=/pg_restore

RUN chmod +x /bin/data-restore-entry.sh

USER root

ENTRYPOINT ["data-restore-entry.sh"]