From 5a1c5c706bf65881f68efaeb497a99cadab8111e Mon Sep 17 00:00:00 2001 From: peterxcli Date: Sun, 18 Feb 2024 16:35:41 +0800 Subject: [PATCH] fix: Update Dockerfiles and docker-compose.dev.yaml --- Dockerfile_Backend | 3 ++- Dockerfile_Notifier | 3 ++- docker/docker-compose.dev.yaml | 23 +++++++++++++++++++++++ script/run.sh | 6 +++--- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Dockerfile_Backend b/Dockerfile_Backend index 23ef726..972895b 100644 --- a/Dockerfile_Backend +++ b/Dockerfile_Backend @@ -17,7 +17,8 @@ RUN go mod download RUN CGO_ENABLED=1 GOOS=linux go build -o /app/main ./cmd/backend/main.go # Runtime Stage -FROM busybox AS runtime +FROM alpine:latest AS runtime +RUN apk --no-cache add ca-certificates # Copy the binary from the build stage to the runtime stage COPY --from=build /app/main /app diff --git a/Dockerfile_Notifier b/Dockerfile_Notifier index aa09736..18c1323 100644 --- a/Dockerfile_Notifier +++ b/Dockerfile_Notifier @@ -17,7 +17,8 @@ RUN go mod download RUN CGO_ENABLED=1 GOOS=linux go build -o /app/main ./cmd/notifier/main.go # Runtime Stage -FROM busybox AS runtime +FROM alpine:latest AS runtime +RUN apk --no-cache add ca-certificates # Copy the binary from the build stage to the runtime stage COPY --from=build /app/main /app diff --git a/docker/docker-compose.dev.yaml b/docker/docker-compose.dev.yaml index 2d006d7..0ea4855 100644 --- a/docker/docker-compose.dev.yaml +++ b/docker/docker-compose.dev.yaml @@ -30,6 +30,29 @@ services: # networks: # - bike-networks + db: + image: postgres:latest + restart: always + environment: + POSTGRES_DATABASE: ${APP_DB_DATABASE} + POSTGRES_USER: ${APP_DB_USERNAME} + POSTGRES_PASSWORD: ${APP_DB_PASSWORD} + ports: + - "5432:5432" + networks: + - bike-networks + + redis: + image: redis:latest + restart: always + environment: + TZ: ${APP_SERVER_TIMEZONE} + ports: + - ${APP_REDIS_PORT}:6379 + networks: + - bike-networks + + pgadmin: image: dpage/pgadmin4 container_name: bike-pgadmin diff --git a/script/run.sh b/script/run.sh index e8f93ee..36c9746 100755 --- a/script/run.sh +++ b/script/run.sh @@ -61,11 +61,11 @@ case "$action" in start|stop|teardown) export_env $mode if [ "$action" = "start" ]; then - $DOCKER_COMP -f docker/docker-compose.yaml -f docker/docker-compose.${mode}.yaml up -d ${@:3} + $DOCKER_COMP -f docker/docker-compose.${mode}.yaml up -d ${@:3} elif [ "$action" = "stop" ]; then - $DOCKER_COMP -f docker/docker-compose.yaml -f docker/docker-compose.${mode}.yaml down + $DOCKER_COMP -f docker/docker-compose.${mode}.yaml down elif [ "$action" = "teardown" ]; then - $DOCKER_COMP -f docker/docker-compose.yaml -f docker/docker-compose.${mode}.yaml down --remove-orphans -v + $DOCKER_COMP -f docker/docker-compose.${mode}.yaml down --remove-orphans -v echo "*** WARNING ***" echo "Please run 'sudo rm -rf docker/volumes' by yourself to remove the persistent volumes" else