Skip to content

Commit

Permalink
Merge pull request #206 from cs50/jdk
Browse files Browse the repository at this point in the history
Updates JDK to 22
  • Loading branch information
rongxin-liu authored Mar 27, 2024
2 parents 84e95d0 + f53ac77 commit 1bf9174
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
with:
build-args: |
VCS_REF=${{ github.sha }}
BUILDARG=amd64
load: true
platforms: linux/amd64
tags: cs50/cli:amd64
Expand All @@ -41,6 +42,7 @@ jobs:
with:
build-args: |
VCS_REF=${{ github.sha }}
BUILDARG=arm64
load: true
platforms: linux/arm64
tags: cs50/cli:arm64
Expand Down
20 changes: 12 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Build stage
FROM ubuntu:22.04 as builder


# Build-time variables
ARG DEBIAN_FRONTEND=noninteractive
ARG BUILDARCH


# Stage-wide dependencies
Expand All @@ -11,14 +15,14 @@ RUN apt update && \
curl


# Install Java 21.x
# http://jdk.java.net/21/
# Install Java 22.x
# http://jdk.java.net/22/
RUN cd /tmp && \
if [ $(uname -m) = "arm64" ]; then ARCH="aarch64"; else ARCH="x64"; fi && \
curl --remote-name https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/openjdk-21.0.2_linux-${ARCH}_bin.tar.gz && \
tar xzf openjdk-21.0.2_linux-${ARCH}_bin.tar.gz && \
rm --force openjdk-21.0.2_linux-${ARCH}_bin.tar.gz && \
mv jdk-21.0.2 /opt/jdk && \
if [ "$BUILDARCH" = "arm64" ]; then ARCH="aarch64"; else ARCH="x64"; fi && \
curl --remote-name https://download.java.net/java/GA/jdk22/830ec9fcccef480bb3e73fb7ecafe059/36/GPL/openjdk-22_linux-${ARCH}_bin.tar.gz && \
tar xzf openjdk-22_linux-${ARCH}_bin.tar.gz && \
rm --force openjdk-22_linux-${ARCH}_bin.tar.gz && \
mv jdk-22 /opt/jdk && \
mkdir --parent /opt/bin && \
ln --symbolic /opt/jdk/bin/* /opt/bin/ && \
chmod a+rx /opt/bin/*
Expand Down Expand Up @@ -86,7 +90,7 @@ RUN apt update && \
tar xzf ruby-3.3.0.tar.gz && \
rm --force ruby-3.3.0.tar.gz && \
cd ruby-3.3.0 && \
if [ $(uname -m) = "arm64" ]; then ASFLAGS=-mbranch-protection=pac-ret; else ASFLAGS=; fi && \
if [ "$BUILDARCH" = "arm64" ]; then ASFLAGS=-mbranch-protection=pac-ret; else ASFLAGS=; fi && \
ASFLAGS=${ASFLAGS} CFLAGS=-Os ./configure --disable-install-doc --enable-load-relative && \
make && \
make install && \
Expand Down
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
ifeq ($(shell uname -m), arm64)
TAG := arm64
else
TAG := amd64
endif
IMAGE := cs50/cli

.PHONY: default
default: run

build:
docker build --build-arg TAG=$(TAG) --build-arg VCS_REF=$(shell git rev-parse HEAD) --tag cs50/cli:$(TAG) .
docker build --build-arg VCS_REF=$(shell git rev-parse HEAD) --tag $(IMAGE) .

depends:
pip3 install docker-squash

rebuild:
docker build --build-arg TAG=$(TAG) --build-arg VCS_REF=$(shell git rev-parse HEAD) --no-cache --tag cs50/cli:$(TAG) .
docker build --build-arg VCS_REF=$(shell git rev-parse HEAD) --no-cache --tag $(IMAGE) .

run:
docker run --env LANG=$(LANG) --env LOCAL_WORKSPACE_FOLDER="$(PWD)" --interactive --publish-all --rm --security-opt seccomp=unconfined --tty --volume "$(PWD)":/mnt --volume /var/run/docker.sock:/var/run/docker-host.sock --workdir /mnt cs50/cli:$(TAG) bash --login || true
docker run --env LANG=$(LANG) --env LOCAL_WORKSPACE_FOLDER="$(PWD)" --interactive --publish-all --rm --security-opt seccomp=unconfined --tty --volume "$(PWD)":/mnt --volume /var/run/docker.sock:/var/run/docker-host.sock --workdir /mnt $(IMAGE) bash --login || true

squash: depends
docker-squash --tag cs50/cli:$(TAG) cs50/cli:$(TAG)
docker-squash --tag $(IMAGE) $(IMAGE)

0 comments on commit 1bf9174

Please sign in to comment.