Skip to content

Instantly share code, notes, and snippets.

@bazzilio
Created October 15, 2018 20:44
Show Gist options
  • Save bazzilio/b5da725536f7d3d643c7d1e60a06a842 to your computer and use it in GitHub Desktop.
Save bazzilio/b5da725536f7d3d643c7d1e60a06a842 to your computer and use it in GitHub Desktop.
Gitlab <-> Docker-compose issues
.build: &build
stage: build
script:
- docker-compose -f ./docker-compose.yml build
.deploy: &deploy
stage: deploy
script:
- docker-compose -f ./docker-compose.yml up -d
.develop_env: &develop_env
variables:
API_URL: https://dev.example.eu/v1/
TICKETS_HOST: dev.tickets.example.eu
NODE_TAG: dev
NODE_NAME: expo-tickets
.staging_env: &staging_env
variables:
API_URL: https://example.eu/v1/
TICKETS_HOST: tickets.example.eu
NODE_TAG: staging
NODE_NAME: expo-tickets
environment:
name: staging
only:
- staging
dev_build:
<<: *develop_env
<<: *build
tags:
- expo-dev
dev_deploy:
<<: *develop_env
<<: *deploy
tags:
- expo-dev
staging_build:
<<: *staging_env
<<: *build
tags:
- expo-dev
staging_deploy:
<<: *staging_env
<<: *deploy
tags:
- expo-dev
$ docker-compose -f ./docker-compose.yml down
Stopping expo-tickets-dev ...
Stopping expo-tickets-dev ... done
Removing expo-tickets-dev ...
Removing expo-tickets-dev ... done
$ docker-compose -f ./docker-compose.yml up -d
Creating expo-tickets-staging ...
Creating expo-tickets-staging ... done
Job succeeded
version: '3'
services:
nginx:
container_name: $NODE_NAME-$NODE_TAG
network_mode: "bridge"
restart: "on-failure"
image: $NODE_NAME:$NODE_TAG
build:
context: .
args:
- NODE_ENV="production"
- API_URL
environment:
- NGINX_PORT=80
- LETSENCRYPT_EMAIL="[email protected]"
- TICKETS_HOST
- LETSENCRYPT_HOST
- VIRTUAL_HOST
expose:
- "80"
Я хочу из одного compose-файла деплоить на один и тот же хост dev и staging
Имена контейнеров и образов отличаются на $NODE_TAG
Однако, при деплое почему-то контейнер с другим тегом убивают и вместо того, чтобы рядом запустить два с разными тегами - работает только один.
Отчего так ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment