add Dockerfile
This commit is contained in:
parent
b340a339c3
commit
f84e91ede2
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
||||
.git
|
||||
.idea
|
||||
debug
|
||||
uploads
|
||||
.env
|
||||
@ -8,6 +8,8 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o server ./cmd/main.go
|
||||
FROM alpine:3.18
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/server .
|
||||
RUN mkdir -p /app/uploads/images
|
||||
COPY --from=builder /app/server ./server
|
||||
EXPOSE 8080
|
||||
EXPOSE 50051
|
||||
CMD ["./server"]
|
||||
|
||||
33
debug/docker-compose.yml
Normal file
33
debug/docker-compose.yml
Normal file
@ -0,0 +1,33 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
container_name: backend-postgres
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${DB_PORT:-5432}:5432"
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_NAME:-game_admin}
|
||||
POSTGRES_USER: ${DB_USER:-game_admin_user}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-game_admin_password}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-game_admin_user} -d ${DB_NAME:-game_admin}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 15s
|
||||
|
||||
adminer:
|
||||
image: adminer:4
|
||||
container_name: backend-adminer
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- postgres
|
||||
ports:
|
||||
- "${ADMINER_PORT:-8081}:8080"
|
||||
environment:
|
||||
ADMINER_DEFAULT_SERVER: postgres
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@ -1,33 +1,14 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
container_name: backend-postgres
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: backend-app
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "${DB_PORT:-5432}:5432"
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_NAME:-game_admin}
|
||||
POSTGRES_USER: ${DB_USER:-game_admin_user}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-game_admin_password}
|
||||
- "${SERVER_PORT:-8080}:8080"
|
||||
- "${GRPC_PORT:-50051}:50051"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-game_admin_user} -d ${DB_NAME:-game_admin}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 15s
|
||||
|
||||
adminer:
|
||||
image: adminer:4
|
||||
container_name: backend-adminer
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- postgres
|
||||
ports:
|
||||
- "${ADMINER_PORT:-8081}:8080"
|
||||
environment:
|
||||
ADMINER_DEFAULT_SERVER: postgres
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
- ./uploads:/app/${UPLOAD_DIR:-uploads}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user