Add seperate Dockerfile step for test to be skipable for base or tools builds

pull/10/head
Jan-Lukas Else 7 months ago
parent cdf5fd12ce
commit e27cbf7b40
  1. 1
      .drone.yml
  2. 8
      Dockerfile

@ -14,6 +14,7 @@ steps:
commands:
- sleep 5 # give docker enough time to start
- echo $DOCKER_PASSWORD | docker login --username jlelse --password-stdin ghcr.io
- DOCKER_BUILDKIT=1 docker build -t temptest . --target test
- DOCKER_BUILDKIT=1 docker build -t ghcr.io/jlelse/goblog:latest . --target base
- DOCKER_BUILDKIT=1 docker build -t ghcr.io/jlelse/goblog:tools . --target tools
- docker push --all-tags ghcr.io/jlelse/goblog

@ -1,4 +1,4 @@
FROM golang:1.17-alpine3.15 as build
FROM golang:1.17-alpine3.15 as buildbase
WORKDIR /app
RUN apk add --no-cache git gcc musl-dev
@ -10,7 +10,13 @@ ADD testdata/ /app/testdata/
ADD templates/ /app/templates/
ADD leaflet/ /app/leaflet/
ADD dbmigrations/ /app/dbmigrations/
FROM buildbase as test
RUN go test -cover ./...
FROM buildbase as build
RUN go build -ldflags '-w -s' -o GoBlog
FROM alpine:3.15 as base

Loading…
Cancel
Save