Skip to content

Commit

Permalink
chron: 普通镜像和带有nvidia驱动镜像分开
Browse files Browse the repository at this point in the history
  • Loading branch information
jamebal committed May 2, 2024
1 parent e37ea69 commit 6937600
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/build-nvidia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build jmalcloud Docker Image

on:
workflow_dispatch:
release:
types: [published]
tags: [v*]

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 17 and Maven 3.8.4
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
maven-version: '3.8.4'

- name: Build with Maven
run: mvn clean package -DskipTests

- name: Extract project version from pom.xml
run: |
VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: docker/jmalcloud-nvidia
file: docker/jmalcloud-nvidia/Dockerfile
push: true
tags: jmal/jmalcloud-nvidia:${{ env.PROJECT_VERSION }},jmal/jmalcloud-nvidia:latest
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ env.PROJECT_VERSION }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM jmal/jdk17_ffmpeg_nvidia:latest
FROM jmal/jdk17_ffmpeg:latest

ENV MONGODB_URI "mongodb://mongo:27017/jmalcloud"
ENV RUN_ENVIRONMENT=prod
Expand Down
29 changes: 29 additions & 0 deletions docker/jmalcloud-nvidia/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM jmal/jdk17_ffmpeg_nvidia:latest

ENV MONGODB_URI "mongodb://mongo:27017/jmalcloud"
ENV RUN_ENVIRONMENT=prod

ARG VERSION

RUN mkdir -p /jmalcloud/files

ADD ../ip2region.xdb /jmalcloud/

ADD ../../target/clouddisk-${VERSION}-exec.jar /usr/local/

VOLUME /jmalcloud/

# 设置支持的平台
ARG TARGETPLATFORM
RUN echo "Building for platform: $TARGETPLATFORM"
LABEL org.label-schema.build.multi-platform=true
ENV PLATFORM=$TARGETPLATFORM
ENV VERSION=${VERSION}

# 将 Linux/arm64/v8 架构设置为默认平台
# 如果需要,可以根据需要更改此设置
ENV DOCKER_DEFAULT_PLATFORM=linux/amd64,linux/arm64

EXPOSE 8088

CMD java -jar -Xms50m -Xmx512m /usr/local/clouddisk-$VERSION-exec.jar --spring.profiles.active=$RUN_ENVIRONMENT --spring.data.mongodb.uri=$MONGODB_URI --file.monitor=false --file.rootDir=/jmalcloud/files --file.ip2region-db-path=/jmalcloud/ip2region.xdb

0 comments on commit 6937600

Please sign in to comment.