Skip to content
Snippets Groups Projects
Commit 9ab239fd authored by Griefed's avatar Griefed :joystick:
Browse files

Add CI/CD files according to tests.

parent 276ae357
No related branches found
No related tags found
No related merge requests found
.git
.gitignore
.github
.gitattributes
README.md
LICENSE.md
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
stages:
- readme
- build
image: docker:19.03.8
readme:
stage: readme
image: alpine:3.12
script:
- apk add gettext
- source .gitlab/.readme_variables
- echo ""
- echo ""
- echo $LOGO_IMAGE_LINK
- echo $GITHUB_REPONAME
- echo $GITHUB_USERNAME
- echo $DOCKERHUB_REPONAME
- echo $DOCKERHUB_TAG
- echo $DOCKERHUB_USERNAME
- echo $DESCRIPTION
- echo $CREATOR_USERNAME
- echo $CREATOR_REPONAME
- echo $EXAMPLE_SITE_LINK
- echo $EXAMPLE_IMAGE_LINK
- echo $CONTAINER_PORT
- echo ""
- echo ""
- envsubst < .gitlab/readme_template | less
- echo ""
- echo ""
build:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
export LOGO_IMAGE_LINK='https://www.example.com/example.png'
export GITHUB_REPONAME='docker-template-repo'
export GITHUB_USERNAME='username'
export DOCKERHUB_REPONAME='template-repo'
export DOCKERHUB_TAG='tag'
export DOCKERHUB_USERNAME='username'
export DESCRIPTION='This is an example description for the docker-template-repo. This text should be replaced with an adequate description of the repo this template was clone for. Blablablablablabla you know the drill.'
export CREATOR_USERNAME='Griefed'
export CREATOR_REPONAME='template'
export EXAMPLE_SITE_LINK='https://www.example.com'
export EXAMPLE_IMAGE_LINK='https://www.example.com/screenshot.png'
export CONTAINER_PORT='1234'
[![$GITHUB_REPONAME]($LOGO_IMAGE_LINK)](https://github.com/$CREATOR_NAME/$CREATOR_REPO)
[![Docker Pulls](https://img.shields.io/docker/pulls/griefed/$DOCKER_REPONAME?style=flat-square)](https://hub.docker.com/repository/docker/griefed/$DOCKER_REPONAME)
[![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/griefed/$DOCKER_REPONAME?label=Image%20size&sort=date&style=flat-square)](https://hub.docker.com/repository/docker/griefed/$DOCKER_REPONAME)
[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/griefed/$DOCKER_REPONAME?label=Docker%20build&style=flat-square)](https://hub.docker.com/repository/docker/griefed/$DOCKER_REPONAME)
[![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/griefed/$DOCKER_REPONAME?label=Docker%20build&style=flat-square)](https://hub.docker.com/repository/docker/griefed/$DOCKER_REPONAME)
[![GitHub Repo stars](https://img.shields.io/github/stars/Griefed/$GITHUB_REPONAME?label=GitHub%20Stars&style=social)](https://github.com/Griefed/$GITHUB_REPONAME)
[![GitHub forks](https://img.shields.io/github/forks/Griefed/$GITHUB_REPONAME?label=GitHub%20Forks&style=social)](https://github.com/Griefed/$GITHUB_REPONAME)
$GITHUB_REPONAME
$DESCRIPTION
[![$CREATOR_REPONAME]($EXAMPLE_IMAGE_LINK)](https://github.com/$CREATOR_NAME/$CREATOR_REPO)
---
Creates a Container which runs [CREATOR_USERNAME's](https://github.com/$CREATOR_USERNAME) [$CREATOR_REPONAME](https://github.com/$CREATOR_USERNAME/$CREATOR_REPONAME), with [lsiobase/alpine](https://hub.docker.com/r/lsiobase/alpine) as the base image, as seen on $EXAMPLE_SITE_LINK.
The lasiobase/alpine image is a custom base image built with [Alpine linux](https://alpinelinux.org/) and [S6 overlay](https://github.com/just-containers/s6-overlay).
Using this image allows us to use the same user/group ids in the container as on the host, making file transfers much easier
## Deployment
### Pre-built images
```docker-compose.yml
version: '3.6'
services:
$GITHUB_REPONAME:
container_name: $GITHUB_REPONAME
image: griefed/$GITHUB_REPONAME
restart: unless-stopped
volumes:
- ./path/to/config:/config
- ./path/to/data:/data
environment:
- TZ=Europe/Berlin
- PUID=1000 # User ID
- PGID=1000 # Group ID
ports:
- 8080:$COTNAINER_PORT
```
## Configuration
Configuration | Explanation
------------ | -------------
[Restart policy](https://docs.docker.com/compose/compose-file/#restart) | "no", always, on-failure, unless-stopped
config volume | Contains config files and logs.
data volume | Contains your/the containers important data.
TZ | Timezone
PUID | for UserID
PGID | for GroupID
ports | The port where the service will be available at.
## User / Group Identifiers
When using volumes, permissions issues can arise between the host OS and the container. [Linuxserver.io](https://www.linuxserver.io/) avoids this issue by allowing you to specify the user `PUID` and group `PGID`.
Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
```
$ id username
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
```
### Raspberry Pi & building the image yourself
Using the [Dockerfile](https://github.com/Griefed/$GITHUB_REPONAME/Dockerfile), this container can be built and run on a Raspberry Pi.
I've tested it on a Raspberry Pi 3B.
#### docker-compose.yml
```docker-compose.yml
version: '3.6'
services:
$GITHUB_REPONAME:
container_name: $GITHUB_REPONAME
build: ./$GITHUB_REPONAME/
restart: unless-stopped
volumes:
- ./path/to/config/files:/config
- ./path/to/data:/data
environment:
- TZ=Europe/Berlin
- PUID=1000 # User ID
- PGID=1000 # Group ID
ports:
- 8080:$CONTAINER_PORT
```
1. Clone the repository: `git clone https://github.com/Griefed/$GITHUB_REPONAME.git ./$GITHUB_REPONAME`
1. Prepare docker-compose.yml file as seen above
1. `docker-compose up -d --build $GITHUB_REPONAME`
1. Visit IP.ADDRESS.OF.HOST:8080
1. ???
1. Profit!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment