Skip to content

Instantly share code, notes, and snippets.

@f213
Last active September 30, 2021 21:11
Show Gist options
  • Save f213/f25dc2ddbcfdf7baf037760b66206e53 to your computer and use it in GitHub Desktop.
Save f213/f25dc2ddbcfdf7baf037760b66206e53 to your computer and use it in GitHub Desktop.
version: 2
defaults: &defaults
docker:
- image: circleci/python:3.6-stretch
environment:
- DATABASE_URL=postgres://root:@postgres:5432/circle_test
- CELERY_BACKEND=redis://redis:6379
- ELASTICSEARCH_HOST=http://elasticsearch:9200
jobs:
build-docker-image:
steps:
- attach_workspace:
at: .
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Store environment variables
command: |
sudo apt-get -y --no-install-recommends install gettext-base
envsubst < src/app/build_env.py > src/app/build_env.with.env.py
mv src/app/build_env.with.env.py src/app/build_env.py
- run:
name: Build and upload docker image
command: |
export D_RELEASE=0.2.4
wget -O - https://cdn.rawgit.com/f213/d/351d2459/install.sh|sh
./d build-image gdml/image src
./d push-image gdml/image
deploy-service:
steps:
- attach_workspace:
at: .
- run:
name: Install deploy tooling
command: |
export D_RELEASE=0.3.0
wget -O - https://cdn.rawgit.com/f213/d/351d2459/install.sh|sh
- run:
name: Add host key
command: ./d add-host-key
- run:
name: Migrate DB
command: |
./d run-command -i gdml/image:${CIRCLE_SHA1} --env-from=service_api [email protected] ./manage.py migrate --noinput
- run:
name: Update image
command: |
./d update-image [email protected] service gdml/image:${CIRCLE_SHA1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment