Skip to content

Commit

Permalink
feat: Optimize Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienfi committed Dec 28, 2023
1 parent 2f7f0c3 commit 7c9d12e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,33 @@ WORKDIR /build

# Install dependencies
RUN apt-get update && \
apt-get install -y unzip
apt-get install -y unzip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# 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 and setup Structurizr CLI
COPY structurizr-cli-*.zip /build/
RUN mkdir /build/structurizr-cli && \
unzip structurizr-cli-*.zip -d /build/structurizr-cli && \
chmod +x /build/structurizr-cli/structurizr.sh && \
rm structurizr-cli-*.zip

# Final image
### Final image ###
FROM eclipse-temurin:17.0.8.1_1-jre-jammy

# Create a non-root user
# Install dependencies and clean up
RUN apt-get update && \
apt-get install -y graphviz jq git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*


### Create a non-root user ###
RUN useradd -m structurizr
USER structurizr

Expand All @@ -37,15 +45,9 @@ COPY --from=builder /usr/local/bin/plantuml /usr/local/bin/
WORKDIR /usr/local/structurizr-cli
ENV PATH /usr/local/structurizr-cli/:/usr/local/bin/:$PATH

# Install dependencies and clean up
RUN apt-get update && \
apt-get install -y graphviz jq git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

# Setup Git configuration
RUN git config --global user.name github-actions && \
git config --global user.email [email protected]

# Set the entry point
ENTRYPOINT ["./structurizr.sh"]
ENTRYPOINT ["./structurizr.sh"]

0 comments on commit 7c9d12e

Please sign in to comment.