slimtoolkit / slim

Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)

Home Page:https://slimtoolkit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keeping symlinks

flip111 opened this issue · comments

Expected Behavior

Keep symlink /var/lib/neo4j/data -> /data


Actual Behavior

ENV NEO4J_HOME="/var/lib/neo4j"

<..snip..>
    && mv "${NEO4J_HOME}"/data /data \
    && mv "${NEO4J_HOME}"/logs /logs \
    && chown -R neo4j:neo4j /backup \
    && chmod -R 777 /backup \
    && chown -R neo4j:neo4j /data \
    && chmod -R 777 /data \
    && chown -R neo4j:neo4j /logs \
    && chmod -R 777 /logs \
    && chown -R neo4j:neo4j "${NEO4J_HOME}" \
    && chmod -R 777 "${NEO4J_HOME}" \
    && ls -l / > /dirs1.log \
    && echo "${NEO4J_HOME}"/data > /neo4j_path1.log \
    && ln -s /data "${NEO4J_HOME}"/data \
    && ln -s /logs "${NEO4J_HOME}"/logs \
    && ls -l / > /dirs2.log \
    && ls -l "${NEO4J_HOME}"/data > /neo4j_path2.log \
    && ls -l "${NEO4J_HOME}" > /neo4j_path3.log \
    && mkdir -p /var/lib/neo4j/plugins/ \
    && mv apoc-3.5.0.21-all.jar /var/lib/neo4j/plugins/apoc-3.5.0.21-all.jar \
    && rm -f /docker-entrypoint.sh \
    && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \
    && chmod +x /docker-entrypoint.sh

ENV PATH "/app/cli:${NEO4J_HOME}/bin:${PATH}"
WORKDIR "${NEO4J_HOME}"
VOLUME /data
EXPOSE 80 7474 7687
ENTRYPOINT ["/docker-entrypoint.sh"]

/dirs1.log (only interesting directories shown)

drwxrwxrwx   1 neo4j neo4j       18 Aug  9  2022 data
drwxrwxrwx   1 neo4j neo4j        0 Aug  9  2022 logs

/dirs2.log (only interesting directories shown)

drwxrwxrwx   1 neo4j neo4j       18 Aug  9  2022 data
drwxrwxrwx   1 neo4j neo4j        0 Aug  9  2022 logs

/neo4j_path1.log

/var/lib/neo4j/data

Changes

/neo4j_path2.log

lrwxrwxrwx 1 root root 5 Mar  6 21:04 /var/lib/neo4j/data -> /data

/neo4j_path2.log - after slim

drwx------ 1 neo4j neo4j 36 Mar  6 21:13 databases

/neo4j_path3.log (only interesting directories shown)

lrwxrwxrwx 1 root  root       5 Mar  6 21:04 data -> /data
lrwxrwxrwx 1 root  root       5 Mar  6 21:04 logs -> /logs

/neo4j_path3.log - after slim

drwx------ 1 neo4j neo4j   18 Mar  6 21:13 data
lrwxrwxrwx 1 root  root     5 Mar  6 21:13 logs -> /logs
slim build --http-probe-full --http-probe-start-wait=45 --http-probe-ports 7474,80 --include-exe-file=include-exe.txt --include-path-file=include-path.txt --target=project

include-exe.txt

# init
touch

# supervisor
supervisord
tail

# backup
date
neo4j-admin
ls
rm

# reading log files
less

include-path.txt

/data
/logs
/backup
/app
/usr/share/nginx/html
/var/lib/neo4j/data
/var/lib/neo4j/logs

/dirs1.log
/neo4j_path1.log
/dirs2.log
/neo4j_path2.log
/neo4j_path3.log

Steps to Reproduce the Problem

Not sure, but it reproduces when i run it multiple times. Without slim symlink is kept


Specifications

  • Version: slim version linux/amd64|Transformer|1.40.11|1b271555882eacdfb4e6598d6d0552e9b9b1449b|2024-02-02_01:36:22PM
  • Platform: Ubuntu 23.10

@flip111 Nice use of build flags! Need to repro the condition... Ping me on Discord, so we can investigate

Not sure what your discord handle is

@flip111 my discord handle is in my github profile. try this to see if you still getting the same behavior: https://github.com/mintoolkit/mint/releases/tag/1.41.1 I tried it with a Neo4J container image and it seems to be ok there. Note that you'll need to add the --include-new=false flag to the build/slim command otherwise the minified container image will exit right after it starts.

I will close this for now because the build has changed in some ways that the problem doesn't occur. I will re-open and try to make a reproducible test when it goes wrong again. Thanks for the help!