-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. add Azul Zulu Builds of OpenJDK Signed-off-by: Alan Yeh <[email protected]>
- Loading branch information
0 parents
commit 9ffcf4a
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver-opts: image=moby/buildkit:master | ||
platforms: linux/amd64,linux/arm64 | ||
- name: Docker login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build and push | ||
uses: docker/bake-action@v3 | ||
with: | ||
push: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
############################################################################ | ||
# Global inheritable target | ||
############################################################################ | ||
group "default" { | ||
targets = [ | ||
"openjdk" | ||
] | ||
} | ||
|
||
############################################################################ | ||
# Global inheritable target | ||
############################################################################ | ||
target "_platforms" { | ||
platforms = [ | ||
"linux/arm64", | ||
"linux/amd64" | ||
] | ||
} | ||
|
||
############################################################################ | ||
# Azul Zulu Builds of OpenJDK | ||
# https://www.azul.com | ||
############################################################################ | ||
variable "OPENJDK_VERSION" { | ||
default = "8.0.382" | ||
} | ||
|
||
variable "OPENJDK_SHORT_VERSION" { | ||
default = "8" | ||
} | ||
|
||
target "openjdk" { | ||
inherits = ["_platforms"] | ||
dockerfile = "Dockerfile" | ||
context = "./openjdk" | ||
args = { | ||
OPENJDK_SHORT_VERSION = "${OPENJDK_SHORT_VERSION}" | ||
OPENJDK_VERSION = "${OPENJDK_VERSION}" | ||
|
||
AMD64_PACKAGE = "zulu8.72.0.17-ca-jdk8.0.382-linux_musl_x64" | ||
ARM64_PACKAGE = "zulu8.72.0.17-ca-jdk8.0.382-linux_musl_aarch64" | ||
} | ||
tags = [ | ||
"docker.io/centralx/openjdk:latest", | ||
"docker.io/centralx/openjdk:${OPENJDK_SHORT_VERSION}", | ||
"docker.io/centralx/openjdk:${OPENJDK_SHORT_VERSION}-alpine", | ||
"docker.io/centralx/openjdk:${OPENJDK_VERSION}", | ||
"docker.io/centralx/openjdk:${OPENJDK_VERSION}-alpine" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
######################################################## | ||
# Stage 1 | ||
# 获取构建需要用到的安装包 | ||
######################################################## | ||
FROM alpine:3.18.2 as builder | ||
ARG AMD64_PACKAGE | ||
ARG ARM64_PACKAGE | ||
|
||
WORKDIR /workspace | ||
|
||
# amd64 package | ||
ADD https://cdn.azul.com/zulu/bin/$AMD64_PACKAGE.tar.gz ./linux/amd64/jdk.tar.gz | ||
RUN tar -zxvf ./linux/amd64/jdk.tar.gz -C ./linux/amd64 && \ | ||
mkdir -p ./linux/amd64/jdk && \ | ||
mv ./linux/amd64/$AMD64_PACKAGE/* ./linux/amd64/jdk | ||
|
||
# arm64 package | ||
ADD https://cdn.azul.com/zulu/bin/$ARM64_PACKAGE.tar.gz ./linux/arm64/jdk.tar.gz | ||
RUN tar -zxvf ./linux/arm64/jdk.tar.gz -C ./linux/arm64 && \ | ||
mkdir -p ./linux/arm64/jdk && \ | ||
mv ./linux/arm64/$ARM64_PACKAGE/* ./linux/arm64/jdk | ||
|
||
######################################################## | ||
# Stage 2 | ||
# 只复制指定架构的包 | ||
# 设置相关环境变量 | ||
######################################################## | ||
FROM --platform=$TARGETPLATFORM alpine:3.18.2 | ||
MAINTAINER Alan Yeh "[email protected]" | ||
|
||
ARG TARGETPLATFORM | ||
ARG OPENJDK_VERSION | ||
|
||
COPY --from=builder /workspace/$TARGETPLATFORM/jdk /usr/local/jdk | ||
|
||
ENV JAVA_HOME=/usr/local/jdk | ||
ENV JAVA_VERSION=$OPENJDK_VERSION | ||
ENV PATH=/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
ENV LANG C.UTF-8 | ||
|
||
ENV TZ "Asia/Shanghai" | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
CMD ["jshell"] |