Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not generate dockerfiles with ENV DEPS being empty #227

Closed
avsm opened this issue Jul 24, 2020 · 2 comments
Closed

do not generate dockerfiles with ENV DEPS being empty #227

avsm opened this issue Jul 24, 2020 · 2 comments
Labels
type/bug Something isn't working

Comments

@avsm
Copy link
Member

avsm commented Jul 24, 2020

This results in an error in dockerfile parsing, e.g. from https://ci.ocamllabs.io:8100/job/2020-07-24/004716-ci-ocluster-build-f8ddc7

git clone --recursive "https://github.com/favonia/yuujinchou.git" && cd "yuujinchou" && git fetch origin "refs/pull/34/head" && git reset --hard 62d123e5
cat > Dockerfile <<'END-OF-DOCKERFILE'
FROM ocurrent/opam@sha256:84a5debe280b7aded6828f9be21bd0eb82d03c850faa6935ef762d4665e6ead1
# debian-10-ocaml-4.03
WORKDIR /src
RUN sudo chown opam /src
RUN cd ~/opam-repository && (git reset --hard 1a576beaaa094013d2935556a76bf48f89ae6098 || (git pull origin master && git reset --hard 1a576beaaa094013d2935556a76bf48f89ae6098)) && opam update -u
RUN mkdir -p "./"
COPY yuujinchou.opam ./
RUN opam pin add -yn yuujinchou.dev "./"
ENV DEPS 
RUN opam depext --update -y yuujinchou.dev $DEPS
RUN opam install $DEPS
COPY --chown=opam . /src/
RUN opam exec -- dune build @install @runtest && rm -rf _build
END-OF-DOCKERFILE
docker build .

2020-07-24 00:47.16: Using cache hint "favonia/yuujinchou-ocurrent/opam@sha256:84a5debe280b7aded6828f9be21bd0eb82d03c850faa6935ef762d4665e6ead1-debian-10-ocaml-4.03-b7c2a91365c1f6898231aa5a71eac69a"
2020-07-24 00:47.16: Waiting for resource in pool OCluster
2020-07-24 00:47.16: Waiting for worker...
2020-07-24 00:47.16: Got resource from pool OCluster
Using BuildKit Dockerfile:
# syntax = docker/dockerfile:experimental@sha256:ee85655c57140bd20a5ebc3bb802e7410ee9ac47ca92b193ed0ab17485024fe5
FROM ocurrent/opam@sha256:84a5debe280b7aded6828f9be21bd0eb82d03c850faa6935ef762d4665e6ead1
# debian-10-ocaml-4.03
WORKDIR /src
RUN sudo chown opam /src
RUN cd ~/opam-repository && (git reset --hard 1a576beaaa094013d2935556a76bf48f89ae6098 || (git pull origin master && git reset --hard 1a576beaaa094013d2935556a76bf48f89ae6098)) && opam update -u
RUN mkdir -p "./"
COPY yuujinchou.opam ./
RUN opam pin add -yn yuujinchou.dev "./"
ENV DEPS 
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,uid=1000 opam depext --update -y yuujinchou.dev $DEPS
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,uid=1000 opam install $DEPS
COPY --chown=opam . /src/
RUN opam exec -- dune build @install @runtest && rm -rf _build
Building on x86-build-5.ocamllabs.io
All commits already cached
HEAD is now at 62d123e Add the efficient Trie.to_seq_values.
#2 [internal] load .dockerignore
#2 sha256:014d103dfe70ba646e0c923b243b14440f2a099d89a55012ddc9dc66266508d7
#2 transferring context: 0.0s
#2 transferring context: 2B 0.0s done
#2 ...

#1 [internal] load build definition from Dockerfile
#1 sha256:3e3bf8d7e84687460518e505107ec466b05eca59241bcef40fb7c66a2b54bca0
#1 transferring dockerfile: 887B 0.0s done
#1 DONE 0.4s

#2 [internal] load .dockerignore
#2 sha256:014d103dfe70ba646e0c923b243b14440f2a099d89a55012ddc9dc66266508d7
#2 DONE 0.5s

#4 docker-image://docker.io/docker/dockerfile:experimental@sha256:ee85655c57140bd20a5ebc3bb802e7410ee9ac47ca92b193ed0ab17485024fe5
#4 sha256:71a594c684f98692da7baadc89226dfbe7a87a365660bd1251c8db6c1d7f4620
#4 CACHED

#3 resolve image config for docker.io/docker/dockerfile:experimental@sha256:ee85655c57140bd20a5ebc3bb802e7410ee9ac47ca92b193ed0ab17485024fe5
#3 sha256:8db1d80318d235996b816ce713bcf8909e6fb35d7d54a0c31710b9c3b442271a
#3 DONE 0.0s
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = ENV must have two arguments
docker-build failed with exit-code 1
2020-07-24 00:47.34: Job failed: Failed: Build failed
@avsm avsm added the type/bug Something isn't working label Jul 26, 2020
@talex5
Copy link
Contributor

talex5 commented Sep 4, 2020

Maybe the analysis phase should reject this. If you're writing an OCaml program, you should at least have a dependency on OCaml.

@talex5
Copy link
Contributor

talex5 commented Jul 7, 2021

Actually, I don't see how this can happen. Building that commit with the current version, I get:

ENV DEPS base-bigarray.base base-threads.base base-unix.base ocaml.4.03.0 ocaml-base-compiler.4.03.0 ocaml-config.1

We always include a version of OCaml, even if the package doesn't specify any dependencies at all.

Closing as probably out-of-date. Please reopen if it's still happening.

@talex5 talex5 closed this as completed Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants