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
|
FROM alpine:3.18
|
||||||
RUN apk add --no-cache ca-certificates tzdata
|
RUN apk add --no-cache ca-certificates tzdata
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/server .
|
RUN mkdir -p /app/uploads/images
|
||||||
|
COPY --from=builder /app/server ./server
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
EXPOSE 50051
|
||||||
CMD ["./server"]
|
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:
|
services:
|
||||||
postgres:
|
app:
|
||||||
image: postgres:16
|
build:
|
||||||
container_name: backend-postgres
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: backend-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
ports:
|
ports:
|
||||||
- "${DB_PORT:-5432}:5432"
|
- "${SERVER_PORT:-8080}:8080"
|
||||||
environment:
|
- "${GRPC_PORT:-50051}:50051"
|
||||||
POSTGRES_DB: ${DB_NAME:-game_admin}
|
|
||||||
POSTGRES_USER: ${DB_USER:-game_admin_user}
|
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-game_admin_password}
|
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- ./uploads:/app/${UPLOAD_DIR:-uploads}
|
||||||
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:
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user