-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile-web
More file actions
40 lines (28 loc) · 791 Bytes
/
Dockerfile-web
File metadata and controls
40 lines (28 loc) · 791 Bytes
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
# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Copy source code
COPY ./ ./
# Install dependencies required for building
RUN apk add --update --no-cache git make
# Build the application
RUN make build-web
# Install the migrate tool
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.18.1
# Final stage
FROM alpine:latest
WORKDIR /app
# Copy files
COPY --from=builder /app/bin/sm4-web ./
COPY --from=builder /app/web ./web
COPY --from=builder /go/bin/migrate ./migrate
COPY --from=builder /app/migrations ./migrations
COPY --from=builder /app/version ./version
# Ensure migrate is executable
RUN chmod +x ./migrate
# Add /app to PATH
ENV PATH="/app:${PATH}"
# Expose port 8000
EXPOSE 8000
# Start the application
CMD ["./sm4-web"]