diff --git a/.drone.yml b/.drone.yml index 75ec0d9..56e89ef 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,3 +1,5 @@ +# Run on all branch pushes +--- kind: pipeline type: docker name: default @@ -18,4 +20,45 @@ steps: volumes: - name: docker-sock host: - path: /var/run/docker.sock \ No newline at end of file + path: /var/run/docker.sock + +trigger: + event: + exclude: + - tag + +# Run on all tag pushes +--- +kind: pipeline +type: docker +name: default + +steps: + - name: Tests + image: docker/compose:1.29.2 + commands: + - docker-compose build + - docker-compose --profile tests build + - docker-compose run --rm db-migrations + - docker-compose up -d + - docker-compose run --rm tests + volumes: + - name: docker-sock + path: /var/run/docker.sock + - name: Build db migration + image: docker/compose:1.29.2 + environment: + DOCKERHUB_TOKEN: + from_secret: dockerhub + commands: + #- docker build -t auth-api-db-migrate: + - env + +volumes: + - name: docker-sock + host: + path: /var/run/docker.sock + +trigger: + event: + - tag diff --git a/Dockerfile b/Dockerfile index 1e321b1..a566950 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17.6-alpine3.14 AS builder +FROM golang:1.17.7-alpine3.15 AS builder # Install missing pkgs RUN apk add --no-cache git diff --git a/Dockerfile.migrations b/Dockerfile.migrations index 3885a08..99755dd 100644 --- a/Dockerfile.migrations +++ b/Dockerfile.migrations @@ -1,3 +1,3 @@ -FROM amacneil/dbmate:v1.12.1 +FROM amacneil/dbmate:v1.14.0 COPY db /db \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 324258b..f1137c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,11 +14,8 @@ services: build: context: . dockerfile: Dockerfile.migrations - # image: amacneil/dbmate:v1.12.1 environment: - DATABASE_URL=postgres://postgres:postgres@postgres:5432/auth?sslmode=disable - # volumes: - # - "./db:/db:ro" command: ["--wait", "up"] profiles: ["migrations"] depends_on: