This repository has been archived by the owner on Jan 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile-sbt
171 lines (162 loc) · 6.84 KB
/
Dockerfile-sbt
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# docker build --network host -t zao111222333/spinalhdl-online:sbt -f Dockerfile-sbt .
# docker push zao111222333/spinalhdl-online:sbt
# docker run -it \
# -p 8849:8080 \
# zao111222333/spinalhdl-online:sbt
FROM debian:11-slim
COPY src/sources.list-bullseye /etc/apt/sources.list
RUN cat /etc/apt/sources.list \
&& rm -Rf /var/lib/apt/lists/* \
&& apt-get update -y && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
sudo \
git \
perl \
gcc \
verilator \
make \
g++ \
apt-utils\
curl\
ca-certificates
#
# jdk
# https://www.oracle.com/java/technologies/downloads/#license-lightbox
ENV JAVA_VERSION 321
ENV JAVA_DIR /usr/local/oracle-java-8
ENV JAVA_HOME ${JAVA_DIR}/jdk1.8.0_${JAVA_VERSION}
COPY src/jdk/jdk-8u${JAVA_VERSION}-linux-x64.tar.gz /tmp/jdk-8u${JAVA_VERSION}-linux-x64.tar.gz
RUN cd /tmp \
&& mkdir ${JAVA_DIR} \
&& tar xzf jdk-8u${JAVA_VERSION}-linux-x64.tar.gz -C ${JAVA_DIR} \
&& update-alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 1500 \
&& update-alternatives --install /usr/bin/javac javac ${JAVA_HOME}/bin/javac 1500 \
&& update-alternatives --install /usr/bin/javaws javaws ${JAVA_HOME}/bin/javaws 1500
#
# scala
# "https://downloads.typesafe.com/scala/2.11.12/scala-2.11.12.tgz"
ENV SCALA_VERSION 2.11.12
ENV SCALA_HOME /usr/local/scala
ENV PATH ${PATH}:${SCALA_HOME}/bin
COPY src/scala/scala-${SCALA_VERSION}.tgz /tmp/scala-${SCALA_VERSION}.tgz
RUN cd /tmp \
&& tar xzf scala-${SCALA_VERSION}.tgz \
&& mkdir ${SCALA_HOME} \
&& rm /tmp/scala-${SCALA_VERSION}/bin/*.bat \
&& mv /tmp/scala-${SCALA_VERSION}/bin /tmp/scala-${SCALA_VERSION}/lib ${SCALA_HOME}\
&& ln -s ${SCALA_HOME}/bin/* /usr/bin/
# zsh & user
ENV USER admin
ENV WORKDIR /DIR/
COPY src/zsh /tmp/zsh
RUN apt-get update && apt-get -y install zsh \
&& useradd -ms /bin/zsh ${USER} \
&& echo "export LC_ALL=C" >> /etc/profile \
# && rm -rf /home/${USER}/.bash* /home/${USER}/.profile \
&& touch /etc/profile.d/null.sh
USER ${USER}
RUN cd /tmp/zsh \
&& ./install.sh
USER root
#
# mill & SpinalHDL
#
# ENV MILL_VERSION 0.9.8
# COPY src/mill/${MILL_VERSION} /usr/local/bin/mill
# COPY src/mill/${MILL_VERSION}-assembly /home/${USER}/.cache/mill/download/${MILL_VERSION}
# COPY src/SpinalTemplateSbt-mill ${WORKDIR}/SpinalTemplateSbt
# COPY src/metals/mirror.properties /home/${USER}/.config/coursier/mirror.properties
# RUN chmod a+x /usr/local/bin/mill\
# && chmod a+x /home/${USER}/.cache/mill/download/${MILL_VERSION}\
# && chown -R ${USER} ${WORKDIR}\
# && mkdir -p /home/${USER}/.cache/coursier\
# && chown -R ${USER} /home/${USER}
# USER ${USER}
# RUN cd ${WORKDIR}/SpinalTemplateSbt \
# && mill mill.contrib.Bloop/install\
# && mill mylib.runMain mylib.MyTopLevelSim
# USER root
#
# sbt
#
ENV SBT_VERSION 1.6.2
ENV SBT_HOME /usr/local/sbt
ENV PATH ${PATH}:${SBT_HOME}/bin
COPY src/sbt/sbt-${SBT_VERSION}.tgz /tmp/sbt-${SBT_VERSION}.tgz
RUN cd /tmp \
&& mkdir ${SBT_HOME} \
&& tar -zxvf sbt-${SBT_VERSION}.tgz \
&& mv sbt/* $SBT_HOME \
&& ln -s ${SBT_HOME}/bin/* /usr/local/bin/
COPY src/SpinalTemplateSbt ${WORKDIR}/SpinalTemplate
COPY src/metals/mirror.properties /home/${USER}/.config/coursier/mirror.properties
RUN chmod a+x ${SBT_HOME}/bin/*\
&& chown -R ${USER} ${WORKDIR}\
&& mkdir -p /home/${USER}/.cache/coursier\
&& chown -R ${USER} /home/${USER}
USER ${USER}
RUN cd ${WORKDIR}/SpinalTemplate \
&& sbt "runMain mylib.MyTopLevelSim"
RUN rm -rf /home/${USER}/.config/coursier/mirror.properties
USER root
#
# code-server
ENV PASSWORD 123456
ENV CODE_VERSION 4.2.0
COPY src/code-server/code-server_${CODE_VERSION}_amd64.deb /tmp/code-server_${CODE_VERSION}_amd64.deb
RUN cd /tmp && dpkg -i code-server_${CODE_VERSION}_amd64.deb
COPY src/icon/vscode-SpinalHDL/192.png /usr/lib/code-server/vendor/modules/code-oss-dev/resources/server/code-192.png
COPY src/icon/vscode-SpinalHDL/512.png /usr/lib/code-server/vendor/modules/code-oss-dev/resources/server/code-512.png
COPY src/icon/vscode-SpinalHDL/1024.png /usr/lib/code-server/vendor/modules/code-oss-dev/resources/server/code.png
COPY src/icon/vscode-SpinalHDL/vscode-SpinalHDL.ico /usr/lib/code-server/vendor/modules/code-oss-dev/resources/server/favicon.ico
COPY src/icon/vscode-SpinalHDL/vscode-SpinalHDL.svg /usr/lib/code-server/vendor/modules/code-oss-dev/resources/server/favicon-dark-support.svg
COPY src/icon/vscode-SpinalHDL/vscode-SpinalHDL.svg /usr/lib/code-server/vendor/modules/code-oss-dev/resources/server/favicon.svg
COPY src/code-server/browser/media /usr/lib/code-server/src/browser/media
COPY src/code-server/browser/pages/login.css /usr/lib/code-server/src/browser/pages/login.css
COPY src/code-server/browser/pages/global.css /usr/lib/code-server/src/browser/pages/global.css
RUN sed -i "s/Welcome to code-server/Welcome to SpinalHDL-Online/" /usr/lib/code-server/src/browser/pages/login.html \
&& sed -i "s/{{PASSWORD_MSG}}/{{PASSWORD_MSG}} <a href=\"https:\/\/github.com\/zao111222333\/spinalhdl-online\/\">more<\/a>/" /usr/lib/code-server/src/browser/pages/login.html
COPY src/code-server/settings.json /home/${USER}/.local/share/code-server/User/settings.json
COPY src/code-server/keybindings.json /home/${USER}/.local/share/code-server/User/keybindings.json
RUN chown -R ${USER} ${WORKDIR}
RUN chown -R ${USER} /home/${USER}
COPY src/code-server/extension /tmp/extension
USER ${USER}
RUN code-server --install-extension /tmp/extension/scala-lang.scala-*.vsix \
&& code-server --install-extension /tmp/extension/scalameta.metals-*.vsix \
&& code-server --install-extension /tmp/extension/mshr-h.VerilogHDL-*.vsix \
&& code-server --install-extension /tmp/extension/bkromhout.vscode-tcl-*.vsix
# && code-server --install-extension /tmp/extension/toem-de.impulse-*.vsix
USER root
# ssh
RUN apt-get update && apt-get install -y --no-install-recommends openssh-server \
&& sed -i "s/#*UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config \
&& sed -i "s/#*UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config
# gtkwave-online
RUN apt-get install -y --no-install-recommends \
libglib2.0-0\
libgtk-3-0\
tk
COPY --from=zao111222333/gtk3:latest /opt/gtkwave/ /opt/gtkwave/
COPY --from=zao111222333/gtk3:latest /opt/gtk/ /opt/gtk/
COPY --from=zao111222333/gtk3:latest /etc/gtk/ /etc/gtk/
RUN rm -rf /usr/bin/gtk-update-icon-cache\
&& ln -s /opt/gtkwave/bin/* /usr/bin/\
&& rm -rf /usr/bin/gtkwave.origin
ENV GDK_BACKEND broadway
ENV GDK_MAX_PORT 1
# nginx
RUN apt-get install -y --no-install-recommends \
apache2-utils\
nginx
COPY src/nginx/nginx.conf /etc/nginx/nginx.conf
RUN echo SpinalHDL-Online > /etc/motd \
&& rm -rf /tmp/* \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo Asia/Shanghai > /etc/timezone
EXPOSE 8080
EXPOSE 22
COPY entrypoint/docker-entrypoint-mill.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]