Skip to content

Commit

Permalink
feat: 更新 Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
wojiushixiaobai committed May 9, 2024
1 parent bfcfd8f commit 7f846fd
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 16 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
run: |
version=$(curl -s 'https://api.github.com/repos/dataease/dataease/releases/latest' | jq -r ".tag_name")
echo "version=${version}" >> $GITHUB_ENV
sed -i "s/ARG VERSION=.*/ARG VERSION=${version}/g" Dockerfile
- name: Check Release
run: |
Expand Down Expand Up @@ -94,7 +95,7 @@ jobs:

- name: Get Dockerfile
run: |
wget -O Dockerfile.release https://github.com/wojiushixiaobai/dataease/raw/master/Dockerfile
wget -O Dockerfile.cicd https://github.com/wojiushixiaobai/dataease/raw/master/Dockerfile.cicd
- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -114,7 +115,7 @@ jobs:
with:
context: .
provenance: false
file: Dockerfile.release
file: Dockerfile.cicd
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
push: true
tags: |
Expand Down
17 changes: 5 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,22 @@ RUN set -e \
&& chmod 755 /usr/local/bin/check \
&& rm -f check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz

RUN mkdir -p /opt/apps/config \
/opt/dataease2.0/drivers \
/opt/dataease2.0/cache \
/opt/dataease2.0/data/map \
/opt/dataease2.0/data/static-resource \
/opt/dataease2.0/data/appearance

RUN set -ex \
&& mkdir -p /deployments \
&& cd /deployments \
&& wget https://github.com/fabric8io-images/run-java-sh/raw/master/fish-pepper/run-java-sh/fp-files/run-java.sh \
&& chmod +x run-java.sh

ARG VERSION=v2.6.0

RUN set -ex \
&& wget https://github.com/wojiushixiaobai/dataease/releases/download/${VERSION}/dataease-${VERSION}.tar.gz \
&& tar -xf dataease-${VERSION}.tar.gz -C /opt --strip-components=1 \
&& rm -f dataease-${VERSION}.tar.gz \
&& mkdir -p /opt/apps/config \
&& cd /opt/apps/config \
&& wget https://github.com/wojiushixiaobai/dataease/raw/master/config/application.yml

ADD drivers/* /opt/dataease2.0/drivers/
ADD mapFiles/ /opt/dataease2.0/data/map/
ADD staticResource/ /opt/dataease2.0/data/static-resource/
ADD core/core-backend/target/CoreApplication.jar /opt/apps/app.jar

FROM debian:bookworm-slim
ARG TARGETARCH

Expand Down
79 changes: 79 additions & 0 deletions Dockerfile.cicd
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
FROM debian:bookworm-slim AS builder
ARG TARGETARCH

ARG DEPENDENCIES=" \
ca-certificates \
wget"

RUN set -ex \
&& apt-get update \
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
&& echo "no" | dpkg-reconfigure dash \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt

ARG CHECK_VERSION=v1.0.2
RUN set -e \
&& wget --quiet https://github.com/jumpserver-dev/healthcheck/releases/download/${CHECK_VERSION}/check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz \
&& tar -xf check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin/ check \
&& chown root:root /usr/local/bin/check \
&& chmod 755 /usr/local/bin/check \
&& rm -f check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz

RUN mkdir -p /opt/apps/config \
/opt/dataease2.0/drivers \
/opt/dataease2.0/cache \
/opt/dataease2.0/data/map \
/opt/dataease2.0/data/static-resource \
/opt/dataease2.0/data/appearance

RUN set -ex \
&& mkdir -p /deployments \
&& cd /deployments \
&& wget https://github.com/fabric8io-images/run-java-sh/raw/master/fish-pepper/run-java-sh/fp-files/run-java.sh \
&& chmod +x run-java.sh

RUN set -ex \
&& mkdir -p /opt/apps/config \
&& cd /opt/apps/config \
&& wget https://github.com/wojiushixiaobai/dataease/raw/master/config/application.yml

ADD drivers/* /opt/dataease2.0/drivers/
ADD mapFiles/ /opt/dataease2.0/data/map/
ADD staticResource/ /opt/dataease2.0/data/static-resource/
ADD core/core-backend/target/CoreApplication.jar /opt/apps/app.jar

FROM debian:bookworm-slim
ARG TARGETARCH

ARG DEPENDENCIES=" \
ca-certificates \
openjdk-17-jre-headless"

RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${DEPENDENCIES} \
&& echo "no" | dpkg-reconfigure dash \
&& echo "securerandom.source=file:/dev/urandom" >> /etc/java-17-openjdk/security/java.security \
&& sed -i "[email protected]=SSLv3, TLSv1, [email protected]=SSLv3@" /etc/java-17-openjdk/security/java.security \
&& sed -i "s@# export @export @g" ~/.bashrc \
&& sed -i "s@# alias @alias @g" ~/.bashrc \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /opt /opt
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /deployments/run-java.sh /deployments/run-java.sh

WORKDIR /opt/apps

ENV JAVA_APP_DIR=/deployments \
JAVA_MAX_HEAP_RATIO=40 \
JAVA_APP_JAR=/opt/apps/app.jar
ENV JAVA_OPTIONS="-Dfile.encoding=utf-8 -Dloader.path=/opt/apps -Dspring.config.additional-location=/opt/apps/config/"

EXPOSE 8100

CMD [ "/deployments/run-java.sh" ]
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ services:
- net

core-de:
image: wojiushixiaobai/dataease:${VERSION}
image: wojiushixiaobai/dataease:${VERSION:-latest}
container_name: de_core
restart: always
environment:
TZ: ${TZ:-Asia/Shanghai}
DB_ENGINE: ${DB_ENGINE:-mysql}
DB_HOST: ${DB_HOST:-mysql-de}
DB_PORT: ${DB_PORT:-3306}
DB_NAME: ${DB_NAME:-dataease}
Expand Down

0 comments on commit 7f846fd

Please sign in to comment.