First basic setup commit

This commit is contained in:
Torsten Raudssus 2024-10-03 03:16:49 +02:00
commit d601b9cf53
6 changed files with 180 additions and 0 deletions

37
.dockerignore Normal file
View file

@ -0,0 +1,37 @@
SciTEDirectory.properties
*/SciTEDirectory.properties
*~
*.sql
*.sql.gz
*.zip
*.log
*.dmp
nytprof*
sublime_*
*.sublime-*
~*
*~
*_
_*
*/.DS_Store
.DS_Store
table_meta*
*#
/*.db
/*.xls
/*.xlsx
/*.csv
/*.pdf
.gitignore
.bash_history
local
tmp
.env
.mc
docker-compose.override.yml
.git
root

35
.gitignore vendored Normal file
View file

@ -0,0 +1,35 @@
SciTEDirectory.properties
*/SciTEDirectory.properties
*~
*.sql
*.sql.gz
*.zip
*.log
*.dmp
nytprof*
sublime_*
*.sublime-*
~*
*~
*_
_*
*/.DS_Store
.DS_Store
table_meta*
*#
/*.db
/*.xls
/*.xlsx
/*.csv
/*.pdf
.bash_history
local
tmp
.env
.mc
docker-compose.override.yml
.git
root

29
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,29 @@
image: docker:latest
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
IMAGE_TAG_RELEASE: $CI_REGISTRY_IMAGE:latest
stages:
- build
- release
services:
- docker:dind
build:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
release:
stage: release
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $IMAGE_TAG
- docker tag $IMAGE_TAG $IMAGE_TAG_RELEASE
- docker push $IMAGE_TAG_RELEASE
only:
- main

29
Dockerfile Normal file
View file

@ -0,0 +1,29 @@
FROM python:3-bookworm
ARG SRV_UID="1000"
ARG SRV_GID="1001"
ARG SRV_VERSION="0"
ENV SRV_UID $SRV_UID
ENV SRV_GID $SRV_GID
ENV SRV_VERSION $SRV_VERSION
ENV SRV_APT_GET_INSTALL $SRV_APT_GET_INSTALL
RUN apt-get update -y && apt-get install -y jq $SRV_APT_GET_INSTALL \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN ( id -g $SRV_GID || groupadd -g $SRV_GID srv ) && \
( id $SRV_UID || useradd -s /bin/bash -d /app -u $SRV_UID -g $SRV_GID srv ) && \
install -o $SRV_UID -g $SRV_GID -d /app
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
USER $SRV_UID:$SRV_GID
RUN ln -s /app/.bash_history $HOME/.bash_history
VOLUME /app
WORKDIR /app
ENTRYPOINT ["/docker-entrypoint.sh"]

29
README.md Normal file
View file

@ -0,0 +1,29 @@
# Python Image
## How To Use
### Args
#### SRV_UID
User ID for the image and so of the data (Default: 1000)
#### SRV_GID
Group ID for the image and so of the data (Default: 1000)
#### SRV_APT_GET_INSTALL
Additional Debian modules installed
### Image Name
```
docker.ci/srv/python:latest
```
### Alias for bash
```shell
alias srvpython='docker run --rm -it -v $(pwd):/app docker.ci/srv/python:latest'
```

21
docker-entrypoint.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
export IP=$( hostname -i )
cat <<EOF
__ _ _
___ _ ____ __/ / __ _ _| |_| |__ ___ _ __
/ __| '__\\ \\ / / / '_ \\| | | | __| '_ \\ / _ \\| '_ \\
\\__ \\ | \\ V / /| |_) | |_| | |_| | | | (_) | | | |
|___/_| \\_/_/ | .__/ \\__, |\\__|_| |_|\\___/|_| |_|
|_| |___/
----------------------------------------------------
IP: $IP
EOF
if [[ -z "$@" ]]; then
exec bash
else
exec $@
fi