-
Notifications
You must be signed in to change notification settings - Fork 128
/
Dockerfile
83 lines (61 loc) · 2.01 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
FROM rust:1.59-buster as build
# create a new empty shell project
RUN USER=root cargo new --bin replibyte
WORKDIR /replibyte
RUN USER=root cargo new --lib replibyte
RUN USER=root cargo new --lib dump-parser
RUN USER=root cargo new --lib subset
# copy over your manifests
# root
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# dump-parser
COPY ./dump-parser ./dump-parser
# subset
COPY ./subset ./subset
# replibyte
COPY ./replibyte/Cargo.toml ./replibyte/Cargo.toml
COPY ./replibyte/Cargo.lock ./replibyte/Cargo.lock
# this build step will cache your dependencies
RUN cargo build --release
RUN rm src/*.rs
# copy your source tree
COPY ./replibyte/src ./replibyte/src
COPY ./dump-parser/src ./dump-parser/src
COPY ./subset/src ./subset/src
# build for release
RUN rm ./target/release/deps/replibyte*
RUN cargo build --release
# our final base
FROM debian:buster-slim
# used to configure Github Packages
LABEL org.opencontainers.image.source https://github.com/qovery/replibyte
# Install Postgres and MySQL binaries
RUN apt-get clean && apt-get update && apt-get install -y \
wget \
postgresql-client \
default-mysql-client
# Install MongoDB tools
RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.5.2.deb && \
apt install ./mongodb-database-tools-*.deb && \
rm -f mongodb-database-tools-*.deb && \
rm -rf /var/lib/apt/lists/*
# copy the build artifact from the build stage
COPY --from=build /replibyte/target/release/replibyte .
COPY ./docker/* /
RUN chmod +x exec.sh && chmod +x replibyte
ARG S3_ACCESS_KEY_ID
ENV S3_ACCESS_KEY_ID $S3_ACCESS_KEY_ID
ARG S3_SECRET_ACCESS_KEY
ENV S3_SECRET_ACCESS_KEY $S3_SECRET_ACCESS_KEY
ARG S3_REGION
ENV S3_REGION $S3_REGION
ARG S3_BUCKET
ENV S3_BUCKET $S3_BUCKET
ARG SOURCE_CONNECTION_URI
ENV SOURCE_CONNECTION_URI $SOURCE_CONNECTION_URI
ARG DESTINATION_CONNECTION_URI
ENV DESTINATION_CONNECTION_URI $DESTINATION_CONNECTION_URI
ARG ENCRYPTION_SECRET
ENV ENCRYPTION_SECRET $ENCRYPTION_SECRET
ENTRYPOINT ["sh", "exec.sh"]