Last active
February 13, 2024 13:41
-
-
Save zeroc0d3/df7f8a8a79c4f503982daa9da5caba01 to your computer and use it in GitHub Desktop.
Build Container CI/CD (devopscorner/cicd) with Docker Compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
#================================================================================================ | |
# NETWORK SETUP | |
#================================================================================================ | |
networks: | |
devopscorner_net: | |
name: devopscorner_net | |
driver: bridge | |
ipam: | |
config: | |
- subnet: 172.146.146.0/16 | |
#================================================================================================ | |
# VOLUME SETUP | |
#================================================================================================ | |
volumes: | |
vol_portainer: | |
driver: ${VOLUMES_DRIVER:-local} | |
driver_opts: | |
o: bind | |
type: none | |
device: ${DATA_PORTAINER:-/opt/data/docker/portainer2.9} | |
vol_cicd_alpine: | |
driver: ${VOLUMES_DRIVER:-local} | |
driver_opts: | |
o: bind | |
type: none | |
device: ${DATA_CICD_ALPINE:-/opt/data/docker/cicd-alpine} | |
services: | |
#================================================================================================ | |
# PORTAINER | |
#================================================================================================ | |
portainer: | |
image: dockerframework/portainer:${PORTAINER_VERSION:-2.9} | |
container_name: ${CONTAINER_PORTAINER:-devopscorner_portainer} | |
restart: unless-stopped | |
ports: | |
- "${PORT_PORTAINER:-5212}:9000" | |
volumes: | |
# - /etc/localtime:/etc/localtime:ro ## Do not use it in mac | |
- /var/run/docker.sock:/var/run/docker.sock ## Do not use it in k8s | |
- vol_portainer:/data | |
environment: | |
- PORTAINER_TEMPLATE=generic | |
- PORTAINER_VERSION=${PORTAINER_VERSION:-2.9} | |
privileged: true | |
networks: | |
devopscorner_net: | |
ipv4_address: ${CONTAINER_IP_PORTAINER:-172.146.146.5} | |
#================================================================================================ | |
# CICD-ALPINE | |
#================================================================================================ | |
cicd-alpine: | |
build: | |
context: . | |
dockerfile: Dockerfile-CICD | |
container_name: ${CONTAINER_CICD_ALPINE:-devopscorner_cicd_alpine} | |
restart: unless-stopped | |
ports: | |
- "${PORT_CICD_ALPINE:-5281}:2222" | |
volumes: | |
# - /etc/localtime:/etc/localtime:ro ## Do not use it in mac | |
- /var/run/docker.sock:/var/run/docker.sock ## Do not use it in k8s | |
environment: | |
- TZ="Asia/Jakarta" | |
- ALPINE_VERSION=${ALPINE_VERSION:-3.16} | |
privileged: true | |
tty: true | |
networks: | |
devopscorner_net: | |
ipv4_address: ${CONTAINER_IP_ALPINE:-172.146.146.213} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment