Finish docker setup
This commit is contained in:
parent
88f3a9b16f
commit
1593775e0f
|
@ -5,9 +5,11 @@
|
|||
!cmd
|
||||
!config
|
||||
!db
|
||||
!feedparser
|
||||
!handler
|
||||
!httpserver
|
||||
!lib
|
||||
!migrations
|
||||
!mocks
|
||||
!models
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ RUN make setup
|
|||
COPY . /app/
|
||||
RUN make build
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
FROM debian:bullseye-slim AS api
|
||||
RUN apt update \
|
||||
&& apt install -y ca-certificates \
|
||||
&& apt clean \
|
||||
|
@ -18,3 +18,6 @@ RUN apt update \
|
|||
|
||||
COPY --from=builder /app/dist/ /app/
|
||||
ENTRYPOINT ["/app/ytrssil-api"]
|
||||
|
||||
FROM migrate/migrate AS migrations
|
||||
COPY ./migrations/ /migrations/
|
||||
|
|
10
Makefile
10
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: all setup ytrssil-api build lint k8s-lint yamllint test test-initdb image-build
|
||||
.PHONY: all setup ytrssil-api build gen-mocks lint yamllint test migrate image-build image-push
|
||||
|
||||
DB_URI ?= postgres://ytrssil:ytrssil@localhost:5431/ytrssil?sslmode=disable
|
||||
|
||||
|
@ -37,4 +37,10 @@ migrate:
|
|||
|
||||
image-build:
|
||||
@echo "# Building docker image..."
|
||||
docker build -t ytrssil-api -f Dockerfile .
|
||||
docker build -t theedgeofrage/ytrssil:api --target api .
|
||||
docker build -t theedgeofrage/ytrssil:migrations --target migrations .
|
||||
|
||||
image-push: image-build
|
||||
@echo "# Pushing docker image..."
|
||||
docker push theedgeofrage/ytrssil:api
|
||||
docker push theedgeofrage/ytrssil:migrations
|
||||
|
|
|
@ -17,7 +17,7 @@ services:
|
|||
retries: 5
|
||||
|
||||
api:
|
||||
build: .
|
||||
image: theedgeofrage/ytrssil:api
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- postgres
|
||||
|
@ -32,5 +32,16 @@ services:
|
|||
retries: 5
|
||||
timeout: 2s
|
||||
|
||||
migrations:
|
||||
image: theedgeofrage/ytrssil:migrations
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- postgres
|
||||
command:
|
||||
- "-path=/migrations/"
|
||||
- "-database"
|
||||
- "postgresql://ytrssil:ytrssil@postgres/ytrssil?sslmode=disable"
|
||||
- "up"
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
|
|
Loading…
Reference in New Issue