update docker stuff
This commit is contained in:
parent
5ef2de6f50
commit
dee563e12a
@ -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
|
||||
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"]
|
||||
|
12
compose.yaml
12
compose.yaml
@ -7,16 +7,24 @@ services:
|
||||
nats:
|
||||
image: docker.io/nats:latest
|
||||
container_name: nats
|
||||
command: ["-js"]
|
||||
networks:
|
||||
- maps-service-network
|
||||
ports:
|
||||
- "4222:4222"
|
||||
|
||||
maps-service:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Containerfile
|
||||
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:
|
||||
- maps-service-network
|
||||
ports:
|
||||
- "8081:8081"
|
||||
|
||||
web:
|
||||
build:
|
||||
@ -24,11 +32,15 @@ services:
|
||||
dockerfile: Containerfile
|
||||
networks:
|
||||
- maps-service-network
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
||||
validation:
|
||||
build:
|
||||
context: validation
|
||||
dockerfile: Containerfile
|
||||
container_name: validation
|
||||
depends_on:
|
||||
- nats
|
||||
networks:
|
||||
- maps-service-network
|
||||
|
Loading…
Reference in New Issue
Block a user