1
0

Compare commits

..

7 Commits

2 changed files with 44 additions and 7 deletions

View File

@@ -5,22 +5,25 @@ LABEL org.opencontainers.image.authors="bluefox@privacynerd.de"
WORKDIR /cmatrix WORKDIR /cmatrix
RUN apk update && \ RUN apk update --no-cache && \
apk add git autoconf automake alpine-sdk ncurses-dev ncurses-static && \ apk add --no-cache git autoconf automake alpine-sdk ncurses-dev ncurses-static && \
git clone https://git.privacynerd.de/Mirrors/cmatrix.git . && \ git clone https://git.privacynerd.de/Mirrors/cmatrix.git . && \
autoreconf -i && \ autoreconf -i && \
mkdir -p /usr/lib/kbd/consolefonts /usr/share/consolefonts && \ mkdir -p /usr/lib/kbd/consolefonts /usr/share/consolefonts && \
./configure LDFLAGS="-static" && \ ./configure LDFLAGS="-static" && \
make make
CMD ["./cmatrix"]
# final cmatrix Container Image # final cmatrix Container Image
FROM alpine FROM alpine
LABEL org.opencontainers.image.authors="bluefox@privacynerd.de" LABEL org.opencontainers.image.authors="bluefox@privacynerd.de"
RUN apk update --no-cache && \
apk add --no-cache ncurses-terminfo-base && \
adduser -g "cmatrix" -s /usr/sbin/nologin -D -H cmatrix
COPY --from=cmatrixbuildimage /cmatrix/cmatrix /cmatrix COPY --from=cmatrixbuildimage /cmatrix/cmatrix /cmatrix
CMD [".cmatrix"] USER cmatrix
ENTRYPOINT ["./cmatrix"]
CMD ["-akb", "-u 3"]

View File

@@ -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
@@ -10,3 +10,37 @@ 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
```