fpapon commented on issue #2325:
URL: https://github.com/apache/shiro/issues/2325#issuecomment-3435611557
> > Example Dockerfile for using shiro hasher cli in container:
> > ```
> > ARG SHIRO_VERSION="2.0.5"
> > FROM maven:sapmachine AS build
> >
> > # Redeclare ARG
> > ARG SHIRO_VERSION
> >
> > WORKDIR /src
> >
> > # Get tar.gz release using curl, wget not installed in maven:sapmachine
by default
> > # -L Follow redirect, empty tar otherwise
> > # -O File is named same as remote file, ie
shiro-root-${SHIRO_VERSION}.tar.gz
> > RUN curl -L -O
https://github.com/apache/shiro/archive/refs/tags/shiro-root-${SHIRO_VERSION}.tar.gz
> >
> > # Use tar, unzip not installed in maven:sapmachine by default
> > RUN tar -xzf shiro-root-${SHIRO_VERSION}.tar.gz
> > WORKDIR /src/shiro-shiro-root-${SHIRO_VERSION}
> > RUN mvn clean package
> >
> > FROM openjdk:25-slim
> >
> > # Redeclare ARG
> > ARG SHIRO_VERSION
> >
> > WORKDIR /opt/app/
> >
> > # Copy shiro hasher cli jar from previous stage
> > COPY --from=build
/src/shiro-shiro-root-${SHIRO_VERSION}/tools/hasher/target/shiro-tools-hasher-${SHIRO_VERSION}-cli.jar
/opt/app/shiro-tools-hasher-cli.jar
> >
> > # Run cli jar
> > ENTRYPOINT ["java", "-jar", "/opt/app/shiro-tools-hasher-cli.jar"]
> >
> > CMD ["--help"]
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Build: `docker build -t shiro-hasher:2.5.0 .` Run by default will
display help message: `docker run -it shiro-hasher:2.5.0` Run to hash password
`test`:
> > ```
> > docker run -it shiro-hasher:2.5.0 -a SHA-512 -f shiro1 -p
> > Password to hash:
> > Password to hash (confirm):
> >
$shiro1$SHA-512$50000$Ac5gu7bPVjdC/S/T8E6Kqw==$/Owa0ULFc3BsuIHY7OKDZCCyU5h5qMBqNHoBudmw3SFyrDuKupL8K5ev78vb25jyYZPs0NCRSyW8HuiQjPIWZQ==
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Currently container is fairly large, ~500MB, scratch or alpine would
help reduce image size.
>
> Thank you. About the first step of the dockerfile, we don't need to build
the project with maven, we should use signed artifact from release. About the
lighweight image we can do better and I also want to try a native build of the
cli with GraalVM. This can be in the release process.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]