Skip to content

Instantly share code, notes, and snippets.

@japhb
Created March 11, 2021 01:14
Show Gist options
  • Save japhb/96ab63db5f19afb29aae3f5b92b1b834 to your computer and use it in GitHub Desktop.
Save japhb/96ab63db5f19afb29aae3f5b92b1b834 to your computer and use it in GitHub Desktop.
(Docker + raku -c) bug

To recreate, copy the two other files in this gist to a directory, and run:

docker build .

You'll see something like this:

Sending build context to Docker daemon  3.072kB
Step 1/5 : FROM rakudo-star:2020.10
 ---> 0ea0359d0e76
Step 2/5 : WORKDIR /app
 ---> Using cache
 ---> 7c5f59e66f97
Step 3/5 : COPY . .
 ---> 81c3b37237b4
Step 4/5 : USER raku
 ---> Running in 55e9af16002a
Removing intermediate container 55e9af16002a
 ---> 2d75a4939c57
Step 5/5 : RUN raku -c -I. -MDockertest -e ''
 ---> Running in 4cb736de718b
BUG!
Syntax OK
Removing intermediate container 4cb736de718b
 ---> c13a18df9a9b
Successfully built c13a18df9a9b

Note the BUG! line, which indicates MAIN was run despite using raku -c to do syntax-check-only mode.

Now if you comment out this line in the Dockerfile:

USER raku

Rerun the build, and no BUG! line.

FROM rakudo-star:2020.10
WORKDIR /app
COPY . .
# This is the bug trigger; comment out and no BUG
USER raku
RUN raku -c -I. -MDockertest -e ''
multi MAIN() is export {
say "BUG!"
}
@JJ
Copy link

JJ commented Mar 11, 2021

Yep, phasers are run... I don't think MAIN should, that's kind of weird.

@japhb
Copy link
Author

japhb commented Mar 11, 2021

Well, phasers up through CHECK, but yeah, it's the running MAIN that's weird -- and only if run as USER raku, not when run as root. WTH is that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment