Skip to content

Commit

Permalink
[Improve] The docker-push.yml ENV syntax bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfboys committed Feb 15, 2025
1 parent cb8921f commit 7a38d7a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
name: "Build Docker Image"

on:
schedule:
- cron: '0 10 * * *'
push:
branches:
- release-*
Expand Down
73 changes: 29 additions & 44 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,47 @@ FROM ubuntu:22.04

USER root

# Install basic tools
RUN apt update && apt install -y wget curl vim net-tools iputils-ping \
&& apt install software-properties-common -y \
&& add-apt-repository ppa:openjdk-r/ppa -y
RUN apt update && apt install -y openjdk-8-jdk
RUN JAVA_PATH=$(ls -l /usr/lib/jvm | grep java-8-openjdk | grep ^d | awk -F ' ' '{print $9}'); \
if [ -z "${JAVA_PATH}" ];then \
echo "JAVA_PATH not found: $JAVA_PATH"; \
exit 2; \
else \
ln -s /usr/lib/jvm/$JAVA_PATH/ /usr/lib/jvm/jdk8; \
fi
ENV JAVA_HOME=/usr/lib/jvm/jdk8
# Install basic tools and dependencies
RUN apt update && \
apt install -y wget curl vim net-tools iputils-ping software-properties-common ca-certificates gnupg && \
add-apt-repository ppa:openjdk-r/ppa -y && \
apt update && \
apt install -y openjdk-8-jdk && \
# Set up Java 8 symlink
JAVA_PATH=$(ls -d /usr/lib/jvm/java-8-openjdk-*) && \
ln -s "$JAVA_PATH" /usr/lib/jvm/jdk8 && \
# Clean up to reduce image size
apt clean && rm -rf /var/lib/apt/lists/*

ENV JAVA_HOME=/usr/lib/jvm/jdk8

# Install docker
RUN \
# Add Docker's official GPG key:
apt update && \
apt install -y ca-certificates curl gnupg && \
install -m 0755 -d /etc/apt/keyrings && \
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
chmod a+r /etc/apt/keyrings/docker.gpg && \
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt update && \
# Install the Docker packages.
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && \
apt clean && rm -rf /var/lib/apt/lists/* \


# Install Tini
ARG TARGETPLATFORM
ENV TINI_VERSION v0.19.0
RUN echo "TARGETPLATFORM: $TARGETPLATFORM"
RUN \
if [ "$TARGETPLATFORM" = "linux/amd64" ];then \
TINI_PLATFORM=amd64; \
wget --no-check-certificate -O /usr/sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-$TINI_PLATFORM; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ];then \
TINI_PLATFORM=arm64; \
wget --no-check-certificate -O /usr/sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-$TINI_PLATFORM; \
else \
echo "unknown TARGETPLATFORM: $TARGETPLATFORM"; \
exit 2; \
fi
RUN chmod +x /usr/sbin/tini
ENV TINI_VERSION=v0.19.0

RUN case "$TARGETPLATFORM" in \
"linux/amd64") TINI_PLATFORM=amd64 ;; \
"linux/arm64") TINI_PLATFORM=arm64 ;; \
*) echo "Unknown TARGETPLATFORM: $TARGETPLATFORM" && exit 2 ;; \
esac && \
wget --no-check-certificate -O /usr/sbin/tini "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TINI_PLATFORM}" && \
chmod +x /usr/sbin/tini

# Install StreamPark
COPY dist/apache-streampark*-*-bin.tar.gz /
RUN tar -zxvf apache-streampark*-*-bin.tar.gz \
&& mv apache-streampark*-*-bin streampark \
&& rm -f apache-streampark*-*-bin.tar.gz

COPY dist/apache-streampark*-*-bin.tar.gz /tmp/streampark.tar.gz
RUN tar -zxvf /tmp/streampark.tar.gz -C /opt && \
mv /opt/apache-streampark*-*-bin /opt/streampark && \
rm -f /tmp/streampark.tar.gz

ENTRYPOINT ["/usr/sbin/tini", "--", "/streampark/bin/streampark.sh", "start_docker"]
18 changes: 3 additions & 15 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@

### 1. Confirm release version
When releasing the new version, the release manager will verify the image tag and push the image to the image repository,
The latest image tag will be written to [docker-compose.yaml](./docker-compose.yaml),users also can independently verify whether the version of the StreamPark image in the [docker-compose.yaml](./docker-compose.yaml) file is correct (If the current branch has not been released, the image tag is the last release image tag):

```yaml
version: '3.8'
services:
streampark-console:
image: apache/streampark:2.2.0
```
### 2. docker-compose up
## 1. run docker-compose up
```shell
docker-compose up -d
docker-compose up -d
```

### 3. open in browser
## 2. open in browser

http://localhost:10000

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ version: '3.8'

services:
streampark:
image: apache/streampark:2.2.0 # Use the previously built image
image: apache/streampark:latest
ports:
- "10000:10000" # Map port 10000 of the container to port 10000 of the host to allow access to the service on that port
environment:
Expand Down

0 comments on commit 7a38d7a

Please sign in to comment.