-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (33 loc) · 1.07 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM oven/bun:1 AS ui-builder
WORKDIR /app
COPY web/package.json web/bun.lockb ./
RUN bun install
COPY web/ ./
RUN VITE_GRAPHQL_API_URL=/query bun run build
# Use an official Go runtime as a parent image
FROM golang:1.23-alpine AS builder
# Set the working directory in the container
WORKDIR /app
RUN go install github.com/vektra/mockery/v2@v2.49.1
# Copy the go.mod and go.sum files into the container
COPY go.mod go.sum ./
# Download the dependencies
RUN go mod download
# Copy the rest of the application code into the container
COPY . .
RUN go generate ./...
RUN go run -mod=mod github.com/99designs/gqlgen gen
COPY --from=ui-builder /app/dist ./changescout/pkg/ui/dist/dist
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -o main .
# Use a slimmer image for the final runtime environment
FROM alpine:latest
# Set the working directory
WORKDIR /app
RUN apk add --no-cache chromium
# Copy only the built application binary from the builder stage
COPY --from=builder /app/main ./
# Expose the port
EXPOSE 3311
# Define the entrypoint
CMD ["./main", "start"]