Skip to content
Snippets Groups Projects
Commit a67ad417 authored by nimrod's avatar nimrod
Browse files

Updates.

What I have in production and GitLab CI/CD.
parent 7dacb31f
No related branches found
No related tags found
No related merge requests found
Pipeline #73 passed
---
image: adarnimrod/ci-images:docker
stages:
- test
- build
- run
pre-commit:
stage: test
image: adarnimrod/ci-images:pre-commit
variables:
XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
# Disabled until https://github.com/pre-commit/pre-commit/issues/1387 is
# resolved.
SKIP: "hadolint,docker-compose"
script:
- pre-commit run --all-files
cache:
paths:
- .cache/
build:
stage: build
tags: ["host01.shore.co.il"]
variables:
COMPOSE_DOCKER_CLI_BUILD: "1"
DOCKER_BUILDKIT: "1"
script:
- docker-compose build --no-cache --pull
- docker-compose pull --quiet
run:
stage: run
tags: ["host01.shore.co.il"]
when: manual
script:
- docker-compose up --detach --remove-orphans
# yamllint disable rule:line-length
- |
for i in $(seq 12)
do
docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$' || break
sleep 10
done
! docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$'
...@@ -2,14 +2,15 @@ ...@@ -2,14 +2,15 @@
--- ---
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0 rev: v2.3.0
hooks: hooks:
- id: check-added-large-files - id: check-added-large-files
- id: check-merge-conflict - id: check-merge-conflict
- id: detect-private-key
- id: trailing-whitespace - id: trailing-whitespace
exclude: \.diff$ exclude: \.diff$
- repo: https://github.com/adrienverge/yamllint - repo: https://github.com/adrienverge/yamllint
rev: v1.19.0 rev: v1.17.0
hooks: hooks:
- id: yamllint - id: yamllint
- repo: https://github.com/amperser/proselint/ - repo: https://github.com/amperser/proselint/
...@@ -17,9 +18,14 @@ repos: ...@@ -17,9 +18,14 @@ repos:
hooks: hooks:
- id: proselint - id: proselint
types: [plain-text] types: [plain-text]
exclude: LICENSE|requirements exclude: LICENSE
- repo: https://www.shore.co.il/git/docker-pre-commit - repo: https://git.shore.co.il/nimrod/docker-pre-commit.git/
rev: v0.3.0 rev: v0.3.0
hooks: hooks:
- id: hadolint - id: hadolint
- id: docker-compose - id: docker-compose
- repo: https://github.com/Yelp/detect-secrets
rev: v0.13.0
hooks:
- id: detect-secrets
exclude: \.diff$
...@@ -10,6 +10,7 @@ RUN apt-get update && \ ...@@ -10,6 +10,7 @@ RUN apt-get update && \
python3-docutils \ python3-docutils \
python3-markdown \ python3-markdown \
python3-pygments \ python3-pygments \
wget \
&& \ && \
setcap CAP_NET_BIND_SERVICE=+ep /usr/sbin/apache2 && \ setcap CAP_NET_BIND_SERVICE=+ep /usr/sbin/apache2 && \
a2enmod cgid && \ a2enmod cgid && \
...@@ -31,9 +32,9 @@ ENV APACHE_RUN_DIR=/run/apache2 \ ...@@ -31,9 +32,9 @@ ENV APACHE_RUN_DIR=/run/apache2 \
APACHE_PID_FILE=/run/apache2/apache2.pid APACHE_PID_FILE=/run/apache2/apache2.pid
RUN patch --strip 0 --verbose --directory /etc/apache2 --input /root/patch.diff && \ RUN patch --strip 0 --verbose --directory /etc/apache2 --input /root/patch.diff && \
apache2 -t apache2 -t
EXPOSE 8080 EXPOSE 80
CMD [ "apache2", "-DFOREGROUND" ] CMD [ "apache2", "-DFOREGROUND" ]
VOLUME ["/srv/git"] VOLUME ["/srv/git"]
USER "www-data" USER "www-data"
WORKDIR /var/www WORKDIR /var/www
HEALTHCHECK CMD wget --spider --quiet http://localhost:8080/cgit/ --user-agent 'Healthcheck' || exit 1 HEALTHCHECK CMD wget --spider --quiet http://localhost:80/cgit/ --user-agent 'Healthcheck' || exit 1
...@@ -4,19 +4,14 @@ version: '3.5' ...@@ -4,19 +4,14 @@ version: '3.5'
services: services:
cgit: cgit:
build: build:
# cache_from:
# - adarnimrod/cgit
context: . context: .
cache_from: # image: adarnimrod/cgit
- adarnimrod/cgit restart: always
image: adarnimrod/cgit
ports:
- 80:80
volumes: volumes:
- git:/srv/git:ro - /var/lib/git:/srv/git:ro
- /etc/passwd:/etc/passwd:ro
volumes:
git:
labels:
snapshot: 'true'
networks: networks:
default: default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment