Skip to content

Commit

Permalink
chore: update Docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Njoguu committed Sep 30, 2023
1 parent 28323a0 commit c0a95b6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ RUN curl -L https://github.com/golang-migrate/migrate/releases/download/v4.14.1/
# ========================
# RUN STAGE
# ========================
FROM alpine:3.17
# FROM alpine:3.17

WORKDIR /app
# WORKDIR /app

COPY --from=builder /app/main .
COPY --from=builder /app/migrate.linux-amd64 ./migrate
COPY .env .
COPY start.sh .
COPY wait-for.sh .
COPY db/migration ./migration
# COPY --from=builder /app/main .
# COPY --from=builder /app/migrate.linux-amd64 ./migrate
# COPY .env .
# COPY start.sh .
# COPY wait-for.sh .
# COPY db/migrations ./migrations

# Expose port 8080 for the API
# Expose port 8000 for the API
EXPOSE 8000

# Set the command to run when the container starts
CMD ["/app/main"]
ENTRYPOINT [ "/app/start.sh" ]
# ENTRYPOINT [ "/app/start.sh" ]
33 changes: 19 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,42 @@ services:
### ===================
### DB SERVICE
### ===================
postgres:
db:
image: postgres:15.3-alpine3.18
env_file:
- .env
container_name: postgres_db
ports:
- 5433:5432
environment:
- POSTGRES_DB=${PG_DB}
- POSTGRES_USER=${PG_USER}
- POSTGRES_PASSWORD=${PG_PASSWORD}
POSTGRES_DB: LoyaltyPointsDB
POSTGRES_USER: Njoguu
POSTGRES_PASSWORD: alannjoguu

restart: always

# ===========
# API SERVICE
# ===========
api:
container_name: api
container_name: gin_api
build:
context: .
dockerfile: Dockerfile
ports:
- 8000:8000
- 8001:8000
env_file:
- .env
depends_on:
- postgres
- redis
entrypoint: [ "/app/wait-for.sh", "postgres:5432", "--", "/app/start.sh"]
command: [ "/app/main" ]
- db
- cache
# entrypoint: [ "/app/wait-for.sh", "postgres:5432", "--", "/app/start.sh"]
# command: [ "/app/main" ]
restart: always

### ===================
### CACHE SERVICE
### ===================
redis:
cache:
container_name: redis_cache
image: redis:7.2-rc2-alpine
ports:
- 6379:6379
- 6380:6379

0 comments on commit c0a95b6

Please sign in to comment.