-
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.
- Loading branch information
1 parent
d189afc
commit 45138f0
Showing
1 changed file
with
33 additions
and
9 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 |
---|---|---|
@@ -1,25 +1,49 @@ | ||
FROM eclipse-temurin:17.0.8.1_1-jre-jammy | ||
# Use a multi-stage build to keep the final image clean and small | ||
FROM eclipse-temurin:17.0.8.1_1-jre-jammy as builder | ||
|
||
WORKDIR /usr/local/structurizr-cli/ | ||
ENV PATH /usr/local/structurizr-cli/:$PATH | ||
# Set the working directory | ||
WORKDIR /build | ||
|
||
# Install additional dependencies (Git, Graphviz, jq) | ||
# Install dependencies in a single layer and clean up | ||
RUN apt-get update && \ | ||
apt-get install -y unzip git graphviz jq && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* | ||
|
||
# Install PlantUML | ||
RUN wget https://downloads.sourceforge.net/project/plantuml/plantuml.jar -O /usr/local/bin/plantuml.jar && \ | ||
echo '#!/bin/bash\njava -jar /usr/local/bin/plantuml.jar "$@"' > /usr/local/bin/plantuml && \ | ||
chmod +x /usr/local/bin/plantuml | ||
|
||
COPY structurizr-cli-*.zip ./ | ||
RUN unzip /usr/local/structurizr-cli/structurizr-cli-*.zip && chmod +x structurizr.sh | ||
# Copy the Structurizr CLI zip | ||
COPY structurizr-cli-*.zip /build/ | ||
|
||
# Unzip Structurizr CLI | ||
RUN unzip structurizr-cli-*.zip && \ | ||
mv structurizr-cli-*/* /build/ && \ | ||
chmod +x structurizr.sh | ||
|
||
# Final image | ||
FROM eclipse-temurin:17.0.8.1_1-jre-jammy | ||
|
||
# Create a non-root user | ||
RUN useradd -m structurizr | ||
USER structurizr | ||
|
||
# Copy necessary files from builder stage | ||
COPY --from=builder /build /usr/local/structurizr-cli | ||
COPY --from=builder /usr/local/bin/plantuml.jar /usr/local/bin/plantuml.jar | ||
COPY --from=builder /usr/local/bin/plantuml /usr/local/bin/plantuml | ||
|
||
# Set the working directory | ||
WORKDIR /usr/local/structurizr-cli | ||
|
||
# Update PATH | ||
ENV PATH /usr/local/structurizr-cli/:$PATH | ||
|
||
# Setup Git | ||
RUN git config --global user.name github-actions && \ | ||
git config --global user.email [email protected] | ||
|
||
WORKDIR /usr/local/structurizr/ | ||
|
||
# Set the entry point | ||
ENTRYPOINT ["./structurizr.sh"] |