Skip to content

Commit

Permalink
Dockerfile: Migrate base image to "debian:buster-slim", use JRE from …
Browse files Browse the repository at this point in the history
…AdoptOpenJDK (#12)

The "ubuntu:focal-20200115" base image we used to temporarily work-around #4 is waaaay too old...

Since #4 is still present, we need to re-platform our base image :-( .

I've chosen "debian:buster-slim" to avoid too many changes (both Debian distros).

I've also had to switch JRE to AdoptOpenJDK; there's no JRE 8 in built-in Debian repos. (why I chose Ubuntu originally...).
  • Loading branch information
klo2k committed Aug 14, 2021
1 parent 621279f commit be93a9d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Download, extract Nexus to /tmp/sonatype/nexus
FROM ubuntu:latest as downloader
FROM debian:buster-slim as downloader

ARG NEXUS_VERSION=3.33.0-01
ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz
Expand All @@ -25,18 +25,27 @@ RUN wget --quiet --output-document=/tmp/nexus.tar.gz "${NEXUS_DOWNLOAD_URL}" &&
# Runtime image
# Logic adapted from official Dockerfile
# https://github.com/sonatype/docker-nexus3/blob/master/Dockerfile
FROM ubuntu:focal-20200115
FROM debian:buster-slim

# Image metadata
# git commit
LABEL org.opencontainers.image.revision="-"
LABEL org.opencontainers.image.source="https://github.com/klo2k/nexus3-docker"

# Install Java 8 and wget
# Install Java 8
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -y --no-install-recommends openjdk-8-jre-headless && \
apt clean
# Add AdoptOpenJDK repo
apt install --yes apt-transport-https ca-certificates gnupg software-properties-common wget && \
wget --quiet --output-document=- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - && \
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ && \
# Work-around adoptopenjdk-8-hotspot-jre installation error
mkdir --parent /usr/share/man/man1/ && \
# Install JRE 8 along with missing dependency
apt update && apt install --yes adoptopenjdk-8-hotspot-jre libatomic1 && \
# Clean-up
apt purge --yes apt-transport-https gnupg software-properties-common wget && \
apt autoremove --yes && apt clean

# Setup: Rename App, Data and Work directory per official image
# App directory (/opt/sonatype/nexus)
Expand Down

0 comments on commit be93a9d

Please sign in to comment.