mirror of https://github.com/jlelse/GoBlog
Add seperate Dockerfile step for test to be skipable for base or tools builds
This commit is contained in:
parent
cdf5fd12ce
commit
e27cbf7b40
|
@ -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…
Reference in New Issue