Finish docker setup
This commit is contained in:
parent
88f3a9b16f
commit
1593775e0f
|
@ -5,9 +5,11 @@
|
||||||
!cmd
|
!cmd
|
||||||
!config
|
!config
|
||||||
!db
|
!db
|
||||||
|
!feedparser
|
||||||
!handler
|
!handler
|
||||||
!httpserver
|
!httpserver
|
||||||
!lib
|
!lib
|
||||||
|
!migrations
|
||||||
!mocks
|
!mocks
|
||||||
!models
|
!models
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ RUN make setup
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
RUN make build
|
RUN make build
|
||||||
|
|
||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim AS api
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install -y ca-certificates \
|
&& apt install -y ca-certificates \
|
||||||
&& apt clean \
|
&& apt clean \
|
||||||
|
@ -18,3 +18,6 @@ RUN apt update \
|
||||||
|
|
||||||
COPY --from=builder /app/dist/ /app/
|
COPY --from=builder /app/dist/ /app/
|
||||||
ENTRYPOINT ["/app/ytrssil-api"]
|
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
|
DB_URI ?= postgres://ytrssil:ytrssil@localhost:5431/ytrssil?sslmode=disable
|
||||||
|
|
||||||
|
@ -37,4 +37,10 @@ migrate:
|
||||||
|
|
||||||
image-build:
|
image-build:
|
||||||
@echo "# Building docker image..."
|
@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
|
retries: 5
|
||||||
|
|
||||||
api:
|
api:
|
||||||
build: .
|
image: theedgeofrage/ytrssil:api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
@ -32,5 +32,16 @@ services:
|
||||||
retries: 5
|
retries: 5
|
||||||
timeout: 2s
|
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:
|
volumes:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
|
|
Loading…
Reference in New Issue