update docker stuff

This commit is contained in:
Quaternions 2024-12-12 12:15:56 -08:00
parent 5ef2de6f50
commit dee563e12a
2 changed files with 47 additions and 2 deletions

View File

@ -1,3 +1,36 @@
# Stage 1: Build
FROM golang:1.23 AS builder
# Set the working directory in the container
WORKDIR /app
# Copy go.mod and go.sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the entire project
COPY . .
# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux go build -o service ./cmd/maps-service/service.go
# Stage 2: Run
FROM alpine FROM alpine
COPY build/server /
ENTRYPOINT ["/server"] # Set up a non-root user for security
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
# Set the working directory in the container
WORKDIR /home/appuser
# Copy the built application from the builder stage
COPY --from=builder /app/service .
# Expose application port (adjust if needed)
EXPOSE 8081
# Command to run the application
CMD ["./service"]

View File

@ -7,16 +7,24 @@ services:
nats: nats:
image: docker.io/nats:latest image: docker.io/nats:latest
container_name: nats container_name: nats
command: ["-js"]
networks: networks:
- maps-service-network - maps-service-network
ports:
- "4222:4222"
maps-service: maps-service:
build: build:
context: . context: .
dockerfile: Containerfile dockerfile: Containerfile
container_name: maps-service container_name: maps-service
command: ["--debug","serve","--pg-host","10.0.0.29","--pg-port","5432","--pg-db","maps","--pg-user","quat","--pg-password","happypostgresuser","--port","8081","--auth-rpc-host","localhost:8090","--nats-host","0.0.0.0:4222"]
depends_on:
- nats
networks: networks:
- maps-service-network - maps-service-network
ports:
- "8081:8081"
web: web:
build: build:
@ -24,11 +32,15 @@ services:
dockerfile: Containerfile dockerfile: Containerfile
networks: networks:
- maps-service-network - maps-service-network
ports:
- "3000:3000"
validation: validation:
build: build:
context: validation context: validation
dockerfile: Containerfile dockerfile: Containerfile
container_name: validation container_name: validation
depends_on:
- nats
networks: networks:
- maps-service-network - maps-service-network