Skip to content

Commit

Permalink
bugfix: Adds tip to maven-integration section to use containers for e… (
Browse files Browse the repository at this point in the history
#497)

* bugfix: Adds tip to maven-integration section to use containers for exercise, and adds example Dockerfiles and docker compose files to examples directory

* chore: linting

* chore: fixed reversed link
  • Loading branch information
meher-liatrio authored Apr 24, 2024
1 parent f759e8d commit 47058be
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/6-release-management/6.2.2-maven-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Here are two ways of doing this.

This section is designed to give you an introduction into how Maven interacts with Nexus and how to use Maven in GitHub Actions.

## Tips

Use containerization for the following exercise, see [examples](https://github.com/liatrio/devops-bootcamp/tree/master/examples/ch6/Dev-Containers).

1. Fork the following repos:
- [spring-petclinic](https://github.com/liatrio/spring-petclinic)
- [joda-time](https://github.com/JodaOrg/joda-time)
Expand Down
16 changes: 16 additions & 0 deletions examples/ch6/Dev-Containers/Dockerfile.joda
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# FROM ubuntu:22.04
FROM --platform=linux/amd64 ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install bash -y && \
apt-get install sudo -y && \
apt-get install git -y && \
apt-get install vim -y && \
apt-get install openjdk-8-jdk -y && \
apt-get install maven -y && \
useradd -ms /bin/bash JODA && usermod -aG sudo JODA && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
WORKDIR /home/joda-time
COPY /joda-time /home/joda-time/
RUN chown -R JODA:JODA /home/joda-time
USER JODA
18 changes: 18 additions & 0 deletions examples/ch6/Dev-Containers/Dockerfile.nexus
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:20.04
# Create the "nexus" user and group
RUN addgroup --system nexus && adduser --system --ingroup nexus nexus
# Create the /opt/nexus directory with the correct permissions
RUN mkdir -p /opt/nexus
# Install required packages and download Nexus
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install wget openjdk-8-jdk -y && \
wget https://download.sonatype.com/nexus/3/nexus-3.64.0-04-unix.tar.gz -P /opt/nexus/
# Move and extract Nexus files
RUN tar -xvf /opt/nexus/nexus-3.64.0-04-unix.tar.gz -C /opt/nexus/ && \
rm -f /opt/nexus/nexus-3.64.0-04-unix.tar.gz
# Set ownership for the Nexus installation directory
RUN chown -R nexus:nexus /opt/nexus
# EXPOSE 8081
USER nexus
ENTRYPOINT ["/opt/nexus/nexus-3.64.0-04/bin/nexus", "run"]
16 changes: 16 additions & 0 deletions examples/ch6/Dev-Containers/Dockerfile.springpetclinic
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# FROM ubuntu:22.04
FROM --platform=linux/amd64 ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install bash -y && \
apt-get install sudo -y && \
apt-get install git -y && \
apt-get install vim -y && \
apt-get install openjdk-17-jdk -y && \
apt-get install maven -y && \
useradd -ms /bin/bash SPC && usermod -aG sudo SPC && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
WORKDIR /home/spring-petclinic
COPY /spring-petclinic /home/spring-petclinic/
RUN chown -R SPC:SPC /home/spring-petclinic
USER SPC
21 changes: 21 additions & 0 deletions examples/ch6/Dev-Containers/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3.8"
services:
jodatime:
container_name: jodatime
build:
dockerfile: Dockerfile.joda
springpetclinic:
container_name: springpetclinic
build:
dockerfile: Dockerfile.springpetclinic
nexusserver:
container_name: nexusserver
build:
dockerfile: Dockerfile.nexus
ports:
- "8081:8081"
volumes:
- nexus:/opt/nexus
- nexus:/nexus-data
volumes:
nexus:

0 comments on commit 47058be

Please sign in to comment.