Use docker-compose watch mode for auth

This commit is contained in:
Zoe Roux 2025-05-19 13:59:47 +02:00
parent 69577d8806
commit fca0d8d7ea
No known key found for this signature in database
4 changed files with 35 additions and 45 deletions

View File

@ -1,10 +1,9 @@
Dockerfile* **
*.md !/go.mod
.dockerignore !/go.sum
.gitignore !/**.go
.env*
# generated via sqlc # generated via sqlc
dbc/ !/sql
!/dbc
# genereated via swag # genereated via swag
docs/ !/docs

View File

@ -1,18 +1,10 @@
FROM golang:1.24 AS build FROM golang:1.24 AS build
WORKDIR /app WORKDIR /app
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
RUN go install github.com/swaggo/swag/cmd/swag@latest
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY sqlc.yaml ./
COPY sql ./sql
RUN sqlc generate
COPY . . COPY . .
RUN swag init --parseDependency --outputTypes json,go
RUN CGO_ENABLED=0 GOOS=linux go build -o /keibi RUN CGO_ENABLED=0 GOOS=linux go build -o /keibi
FROM gcr.io/distroless/base-debian11 FROM gcr.io/distroless/base-debian11
@ -23,5 +15,4 @@ USER nonroot:nonroot
COPY --from=build /keibi /app/keibi COPY --from=build /keibi /app/keibi
COPY sql ./sql COPY sql ./sql
HEALTHCHECK --interval=30s --retries=15 CMD curl --fail http://localhost:4568$KEIBI_PREFIX/health || exit
CMD ["/app/keibi"] CMD ["/app/keibi"]

View File

@ -1,11 +1,10 @@
FROM golang:1.24 AS build FROM golang:1.24 AS build
WORKDIR /app WORKDIR /app
RUN go install github.com/bokwoon95/wgo@latest
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY . .
EXPOSE 4568 EXPOSE 4568
HEALTHCHECK --interval=30s --retries=15 CMD curl --fail http://localhost:4568$KEIBI_PREFIX/health || exit CMD ["go", "run", "-race", "."]
CMD ["wgo", "run", "-race", "."]

View File

@ -21,26 +21,26 @@ x-transcoder: &transcoder-base
- transcoder_metadata:/metadata - transcoder_metadata:/metadata
services: services:
front: # front:
build: # build:
context: ./front # context: ./front
dockerfile: Dockerfile.dev # dockerfile: Dockerfile.dev
volumes: # volumes:
- ./front:/app # - ./front:/app
- /app/.yarn # - /app/.yarn
- /app/node_modules # - /app/node_modules
- /app/apps/mobile/node_modules # - /app/apps/mobile/node_modules
- /app/apps/web/.next/ # - /app/apps/web/.next/
- /app/apps/mobile/.expo/ # - /app/apps/mobile/.expo/
ports: # ports:
- "3000:3000" # - "3000:3000"
- "8081:8081" # - "8081:8081"
restart: on-failure # restart: on-failure
environment: # environment:
- KYOO_URL=${KYOO_URL:-http://api:5000/api} # - KYOO_URL=${KYOO_URL:-http://api:5000/api}
labels: # labels:
- "traefik.enable=true" # - "traefik.enable=true"
- "traefik.http.routers.front.rule=PathPrefix(`/`)" # - "traefik.http.routers.front.rule=PathPrefix(`/`)"
auth: auth:
build: build:
@ -54,13 +54,14 @@ services:
- "4568:4568" - "4568:4568"
env_file: env_file:
- ./.env - ./.env
environment:
- KEIBI_PREFIX=/auth
volumes:
- ./auth:/app
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.auth.rule=PathPrefix(`/auth/`) || PathPrefix(`/.well-known/`)" - "traefik.http.routers.auth.rule=PathPrefix(`/auth/`) || PathPrefix(`/.well-known/`)"
develop:
watch:
- action: sync+restart
path: ./auth
target: /app
api: api:
build: build: