Compare commits
12 Commits
cf1c16f890
...
master
Author | SHA1 | Date | |
---|---|---|---|
8ed1e1b2c2 | |||
971bab4c2f | |||
db7dd90c84 | |||
d0e251de94 | |||
4d94c725a2 | |||
c26be90554 | |||
a4a332f91e | |||
3b81501f01 | |||
f66a7c6370 | |||
31c296d61c | |||
19ff0b5a17 | |||
4dea8a4fef |
58
Dockerfile
58
Dockerfile
@@ -1,37 +1,29 @@
|
|||||||
|
# image for building the binary from source
|
||||||
|
FROM alpine AS cmatrixbuildimage
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.authors="bluefox@privacynerd.de"
|
||||||
|
|
||||||
|
WORKDIR /cmatrix
|
||||||
|
|
||||||
|
RUN apk update --no-cache && \
|
||||||
|
apk add --no-cache git autoconf automake alpine-sdk ncurses-dev ncurses-static && \
|
||||||
|
git clone https://git.privacynerd.de/Mirrors/cmatrix.git . && \
|
||||||
|
autoreconf -i && \
|
||||||
|
mkdir -p /usr/lib/kbd/consolefonts /usr/share/consolefonts && \
|
||||||
|
./configure LDFLAGS="-static" && \
|
||||||
|
make
|
||||||
|
|
||||||
|
|
||||||
|
# final cmatrix Container Image
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
MAINTAINER Benjamin Burkhardt <bluefox@privacynerd.de>
|
LABEL org.opencontainers.image.authors="bluefox@privacynerd.de"
|
||||||
|
|
||||||
#git
|
RUN apk update --no-cache && \
|
||||||
RUN apk update
|
apk add --no-cache ncurses-terminfo-base && \
|
||||||
RUN apk add git
|
adduser -g "cmatrix" -s /usr/sbin/nologin -D -H cmatrix
|
||||||
RUN git clone https://git.privacynerd.de/Mirrors/cmatrix.git
|
COPY --from=cmatrixbuildimage /cmatrix/cmatrix /cmatrix
|
||||||
RUN cd cmatrix/
|
|
||||||
#autoreconf -i # skip if using released tarball
|
|
||||||
RUN apk add --no-cache autoconf
|
|
||||||
#autoreconf -i # skip if using released tarball
|
|
||||||
RUN apk add --no-cache automake
|
|
||||||
RUN autoreconf -i # skip if using released tarball
|
|
||||||
#./configure
|
|
||||||
#autoreconf -i # skip if using released tarball
|
|
||||||
#echo $?
|
|
||||||
#./configure LDFLAGS="-static" # for static compilation
|
|
||||||
RUN apk add alpine-sdk # base compilers
|
|
||||||
#./configure LDFLAGS="-static" # for static compilation
|
|
||||||
#apk add ncurses
|
|
||||||
#./configure LDFLAGS="-static" # for static compilation
|
|
||||||
#apk add ncurses ncurses-dev
|
|
||||||
#./configure LDFLAGS="-static" # for static compilation
|
|
||||||
#apk add ncurses ncurses-dev ncurses-static
|
|
||||||
#./configure LDFLAGS="-static" # for static compilation
|
|
||||||
RUN apk add ncurses-dev ncurses-static
|
|
||||||
#./configure LDFLAGS="-static" # for static compilation
|
|
||||||
#mkdir /usr/lib/kbd/consolefonts /usr/share/consolefonts
|
|
||||||
RUN mkdir /usr/lib/kbd/consolefonts -p
|
|
||||||
RUN mkdir /usr/share/consolefonts -p
|
|
||||||
RUN ./configure LDFLAGS="-static" # for static compilation
|
|
||||||
RUN make
|
|
||||||
|
|
||||||
CMD ["./cmatrix"]
|
USER cmatrix
|
||||||
#./cmatrix -b
|
ENTRYPOINT ["./cmatrix"]
|
||||||
#history
|
CMD ["-akb", "-u 3"]
|
||||||
|
38
README.md
38
README.md
@@ -1,6 +1,6 @@
|
|||||||
# docker-cmatrix
|
# docker-cmatrix
|
||||||
|
|
||||||
A simple docker image I used to teach me the basics of docker images and how to build them.
|
A simple alpine-based docker image I used to teach me the basics of docker images and how to build them.
|
||||||
|
|
||||||
|
|
||||||
## Build the container
|
## Build the container
|
||||||
@@ -9,4 +9,38 @@ To build the container to an image called "cmatrix-demo", run
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker build -t cmatrix-demo .
|
docker build -t cmatrix-demo .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Multi-platform builds
|
||||||
|
|
||||||
|
To do a build for multiple architectures, run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo docker buildx create --name buildx-multi-arch
|
||||||
|
sudo docker buildx use buildx-multi-arch
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, to build it (e.g. for amd64 and arm64/v8):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo docker buildx build --no-cache --platform linux/amd64,linux/arm64/v8 -t cmatrix-demo .
|
||||||
|
```
|
||||||
|
|
||||||
|
**Please note that this will not load the images into the local image store (because it's obviously hard to run images built for the wrong architecture)! For uploading this to a container registry, see below.**
|
||||||
|
|
||||||
|
|
||||||
|
## Pushing the container to a registry
|
||||||
|
|
||||||
|
As you've got everything working, maybe it's time to share the work! This can be done by uploading the built image to a docker container registry, e.g. [Docker Hub](https://hub.docker.com/).
|
||||||
|
|
||||||
|
First, sign into your Docker Hub account with your local docker installation (to create an account head to [https://app.docker.com/signup](https://app.docker.com/signup) in your favourite browser). The procedure is self-explaining:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker login
|
||||||
|
```
|
||||||
|
|
||||||
|
To build and push the image directly to Docker Hub, use the following command (differs from the one above only in the --push option):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo docker buildx build --no-cache --platform linux/amd64,linux/arm64/v8 -t <USER>/cmatrix-demo . --push
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user