-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile.run
81 lines (61 loc) · 2.4 KB
/
Dockerfile.run
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
# Stage 1: Build Stage
FROM gradle:8.6-jdk11 AS build
# Set the working directory
WORKDIR /home/gradle/project
# Copy the project files
COPY sqrl-tools/sqrl-run/gradle-deps/build.gradle /home/gradle/project/build.gradle
# Build the project and run the copyDependencies task
RUN gradle build shadowjar --no-daemon
# Use the official Ubuntu 22.04 as base image
FROM ubuntu:22.04
# Set environment variables
ENV FLINK_VERSION=1.19.1
ENV FLINK_HOME=/opt/flink
ENV KAFKA_HOME=/opt/redpanda
ENV POSTGRES_VERSION=14
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary packages
RUN apt-get update && apt-get install -y \
wget \
openjdk-17-jdk \
ssh \
netcat \
curl \
unzip \
tar \
procps \
ca-certificates \
gnupg \
lsb-release \
postgresql-$POSTGRES_VERSION
# Install Flink
RUN wget -qO- https://archive.apache.org/dist/flink/flink-${FLINK_VERSION}/flink-${FLINK_VERSION}-bin-scala_2.12.tgz | \
tar -xz -C /opt/ && \
ln -s /opt/flink-${FLINK_VERSION} ${FLINK_HOME}
# Add the Redpanda repository
RUN curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | bash
# Install Redpanda
RUN apt-get update && apt-get install -y redpanda
# Expose default Redpanda ports
EXPOSE 8080 8081 8888 9092 9644
# Copy the dependencies from the build stage
COPY --from=build /home/gradle/project/build/libs/ /opt/system_libs/
# Copy the application JAR from the local folder to /opt/
COPY sqrl-tools/sqrl-cli/target/sqrl-cli.jar /opt/sqrl/sqrl-cli.jar
COPY sqrl-tools/sqrl-run/target/sqrl-run.jar /opt/sqrl/sqrl-run.jar
COPY sqrl-tools/sqrl-test/target/sqrl-test.jar /opt/sqrl/sqrl-test.jar
# Todo: added manually since it's not available on maven yet
COPY sqrl-flink-lib/sqrl-jdbc-1.19/target/sqrl-jdbc-1.19-0.5.5-SNAPSHOT.jar /opt/system_libs/sqrl-jdbc-1.19-0.5.5-SNAPSHOT.jar
# Add s3 plugin
RUN mkdir -p /opt/flink/plugins/flink-s3-fs-hadoop
RUN ln -fs /opt/flink/opt/flink-s3-fs-hadoop-*.jar /opt/flink/plugins/flink-s3-fs-hadoop/.
# Copy the entrypoint script
COPY entrypoint-run.sh /entrypoint-run.sh
RUN chmod +x /entrypoint-run.sh
RUN sed -i 's/localhost/0.0.0.0/g' ${FLINK_HOME}/conf/*
RUN service postgresql start && \
su - postgres -c "psql -U postgres -c \"ALTER USER postgres WITH PASSWORD 'postgres';\"" && \
su - postgres -c "psql -U postgres -c \"CREATE DATABASE datasqrl;\""
WORKDIR /build
# Set the entrypoint
ENTRYPOINT ["/entrypoint-run.sh"]