forked from leoheck/kiri-docker
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
143 lines (125 loc) · 3.5 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Latest stable version of Ubuntu, of course
FROM ubuntu:22.04
LABEL org.opencontainers.image.authors "Leandro Heck <[email protected]>, Jacob McSwain <[email protected]>"
LABEL org.opencontainers.image.description "Kicad 7 and KiRI"
LABEL org.opencontainers.image.url "https://github.com/USA-RedDragon/kiri-github-action/pkgs/container/kiri"
LABEL org.opencontainers.image.documentation "https://github.com/USA-RedDragon/kiri-github-action"
LABEL org.opencontainers.image.source "https://github.com/USA-RedDragon/kiri-github-action"
ARG DEBIAN_FRONTEND noninteractive
ARG DEBCONF_NOWARNINGS="yes"
ENV TERM 'dumb'
RUN apt-get update
RUN apt-get install -y \
sudo \
git \
curl \
coreutils \
software-properties-common \
x11-utils \
x11-xkb-utils \
xvfb \
opam \
build-essential \
pkg-config \
libgmp-dev \
util-linux \
python-is-python3 \
python3-pip \
dos2unix \
librsvg2-bin \
imagemagick \
xdotool \
rename \
bsdmainutils ;\
apt-get clean ;\
rm -rf /var/lib/apt/lists/* ;\
rm -rf /var/tmp/*
# Install latest Kicad
RUN add-apt-repository -y ppa:kicad/kicad-7.0-releases
RUN apt-get install --no-install-recommends -y kicad && \
apt-get purge -y \
software-properties-common ;\
apt-get clean ;\
rm -rf /var/lib/apt/lists/* ;\
rm -rf /var/tmp/*
# Create user
RUN useradd -rm -d "/home/github" -s "$(which bash)" -G sudo -u 1001 -U github
# Run sudo without password
RUN echo "github ALL=(ALL) NOPASSWD:ALL" | tee sudo -a "/etc/sudoers"
# Change current user
USER github
WORKDIR "/home/github"
ENV USER github
ENV HOME /home/github
ENV DISPLAY :0
ENV PATH "${PATH}:/home/github/.local/bin"
# Python dependencies
RUN yes | pip3 install \
"pillow>8.2.0" \
"six>=1.15.0" \
"python_dateutil>=2.8.1" \
"pytz>=2021.1" \
"pathlib>=1.0.1" && \
pip3 cache purge
# Opam dependencies
RUN yes | opam init --disable-sandboxing && \
opam switch create 4.10.2 && \
eval "$(opam env)" && \
opam update && \
opam install -y \
digestif \
lwt \
lwt_ppx \
cmdliner \
base64 \
sha \
tyxml \
git-unix ;\
opam clean -a -c -s --logs -r ;\
rm -rf ~/.opam/download-cache ;\
rm -rf ~/.opam/repo/*
# Install kiri, kidiff and plotgitsch
ADD https://api.github.com/repos/leoheck/kiri/git/refs/heads/main kiri_version.json
ENV KIRI_HOME "/home/github/.local/share/kiri"
RUN git clone --recurse-submodules -j8 https://github.com/leoheck/kiri.git "${KIRI_HOME}"
RUN cd "${KIRI_HOME}/submodules/plotkicadsch" && \
opam pin add -y kicadsch . && \
opam pin add -y plotkicadsch . && \
opam install -y plotkicadsch; \
opam clean -a -c -s --logs -r ;\
rm -rf ~/.opam/download-cache ;\
rm -rf ~/.opam/repo/*
ENV PATH "${KIRI_HOME}/bin:${KIRI_HOME}/submodules/KiCad-Diff/bin:${PATH}"
# Clean unnecessary stuff
RUN sudo apt-get purge -y \
curl \
opam \
build-essential \
pkg-config \
libgmp-dev
RUN sudo apt-get -y autoremove
RUN sudo rm -rf \
/tmp/* \
/var/tmp/* \
/usr/share/doc/* \
/usr/share/info/* \
/usr/share/man/*
# Initialize Kicad config files to skip default popups of setup
COPY config "/home/github/.config"
RUN sudo chown -R github:github "/home/github/.config"
COPY entrypoint.sh /entrypoint.sh
RUN sudo chmod a+rx /entrypoint.sh
# GitHub Actions environment variables
ENV KIRI_PROJECT_FILE ""
ENV KIRI_OUTPUT_DIR ""
ENV KIRI_REMOVE ""
ENV KIRI_ARCHIVE ""
ENV KIRI_PCB_PAGE_FRAME ""
ENV KIRI_FORCE_LAYOUT_VIEW ""
ENV KIRI_SKIP_KICAD6_SCHEMATICS ""
ENV KIRI_SKIP_CACHE ""
ENV KIRI_OLDER ""
ENV KIRI_NEWER ""
ENV KIRI_LAST ""
ENV KIRI_ALL ""
ENTRYPOINT ["/entrypoint.sh"]