Giter Club home page Giter Club logo

Comments (6)

gingerbreadassassin avatar gingerbreadassassin commented on August 10, 2024 1

Success! I have a working alpine image up on docker hub:

https://hub.docker.com/r/gingerbreadassassin/plotkicadsch

Here's the Dockerfile:

FROM ocaml/opam2:alpine
RUN cd /home/opam && \
    git clone https://github.com/jnavila/plotkicadsch.git && \
    cd plotkicadsch && \
    opam switch 4.07 && \
    eval $(opam env) &&\
    opam pin add kicadsch . -yn && \
    opam pin add plotkicadsch . -yn && \
    opam depext kicadsch && \
    opam depext plotkicadsch && \
    opam install --deps-only kicadsch && \
    opam install --deps-only plotkicadsch

RUN cd /home/opam/plotkicadsch && \
    sudo chown -R opam:nogroup . && \
    opam install --destdir=/home/opam/pksapp plotkicadsch && \
    opam depext -ln plotkicadsch | egrep -o "\-\s.*" | sed "s/- //" > depexts

FROM alpine
WORKDIR /opt/pksch
COPY --from=0 /home/opam/pksapp/bin/plotkicadsch plotkicadsch.exe
COPY --from=0 /home/opam/pksapp/bin/plotgitsch plotgitsch.exe

COPY --from=0 /home/opam/plotkicadsch/depexts depexts
RUN cat depexts | xargs apk --update add&& rm -rf /var/cache/apk/* && rm depexts

ENV PATH="/opt/pksch:${PATH}"

It may not be the most efficient or completely correct because I just don't know OCaml at all (as in, today was my very first exposure to it), but the resulting image is ~31MB and has both plotgitsch.exe and plotkicadsch.exe in the PATH, so it's easy to use in builds. Here's a .gitlab-ci.yml example from a school project:

image: gingerbreadassassin/plotkicadsch

stages:
  - build

build:
  stage: build
  script:
    - plotkicadsch.exe -f myproject.sch -l myproject-cache.lib
  artifacts:
    paths:
      - myproject.svg

This was sanitized as the project is private for the time being, but I do plan on expanding this so that diffs will be generated in non-master branches. If I have time this weekend I will make a dummy project and publish it.

If you'd like, I could make a PR to add docker support for this repo.

In any case, I'll close this issue. Thanks again for your help!

from plotkicadsch.

gingerbreadassassin avatar gingerbreadassassin commented on August 10, 2024

Building from this git repo fails as well. Here's the revised Dockerfile:

FROM ocaml/opam2

RUN sudo apt install m4 git -y

# Have to use >4.06
RUN opam switch 4.07

RUN eval `opam config env`

RUN git clone https://github.com/jnavila/plotkicadsch.git 
RUN cd plotkicadsch
RUN opam pin add kicadsch . 
RUN opam pin add plotkicadsch . 
RUN opam update 
RUN opam install plotkicadsch

This now fails with:

[ERROR] The compilation of kicadsch failed at "/home/opam/.opam/4.07/bin/dune subst".

#=== ERROR while compiling kicadsch.0.5.1 =====================================#
# context 2.0.5 | linux/x86_64 | ocaml-base-compiler.4.07.1 | pinned(git+file:///home/opam/opam-repository#master#a13dff5f)
# path ~/.opam/4.07/.opam-switch/build/kicadsch.0.5.1
# command ~/.opam/4.07/bin/dune subst
# exit-code 1
# env-file ~/.opam/log/kicadsch-6-aa74e7.env
# output-file ~/.opam/log/kicadsch-6-aa74e7.out
### output ###
# Error: No .opam files found.

from plotkicadsch.

jnavila avatar jnavila commented on August 10, 2024

Yes, I just launched a new build on travis and it failed with the same error. Welcome to yet another dependency hell...

I'll try to push a fix shortly.

from plotkicadsch.

gingerbreadassassin avatar gingerbreadassassin commented on August 10, 2024

OK, cool. I found a problem in my previous Dockerfile. I got this one to fail with the git-unix error:

FROM ocaml/opam2:ubuntu-16.04-opam
RUN sudo apt install m4 -y
RUN cd /home/opam
RUN git clone https://github.com/jnavila/plotkicadsch.git && \
    cd plotkicadsch && \
    opam init -c 4.07.0 --disable-sandboxing -a && \
    eval $(opam env) &&\
    opam pin add kicadsch . -n && \
    opam pin add plotkicadsch . -n && \
    opam update  && \
    opam install -y plotkicadsch

from plotkicadsch.

jnavila avatar jnavila commented on August 10, 2024

Please try again building your Docker image.

from plotkicadsch.

gingerbreadassassin avatar gingerbreadassassin commented on August 10, 2024

It built! But plotkicadsch is only available from within the container if I run opam switch 4.07.0, so I have to fix that bit. I'll test the image to see if it works.

from plotkicadsch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.