DevOps / Scripts
yaml
Advanced
GitLab CI Docker Build and Push
Build and push a Docker image to a registry on every merge to main.
yaml
stages: [build, push]
build:
stage: build
image: docker:24
services: [docker:24-dind]
script:
- docker build -t registry/myapp:latest .
push:
stage: push
script:
- docker push registry/myapp:latest
Prerequisites
- GitLab CI
- Docker registry
Pro Tips
- → Use --cache-from to speed up builds.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- yaml
- Level
- Advanced
- Read time
- 4 min
- Published
- Apr 2024
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
Postgres S3 Backup
Dump a Postgres database, gzip it, push to S3 with AES256 encryption.
bash
·
Intermediate
Disk Usage Alert
Send an alert when any mounted filesystem exceeds a usage threshold.
bash
·
Beginner
Docker Image Cleanup Script
Remove dangling images, stopped containers and unused volumes in one pass.
bash
·
Intermediate