recipes2/Dockerfile

31 lines
956 B
Docker
Raw Permalink Normal View History

2024-01-29 21:55:20 +02:00
FROM golang:alpine AS builder
LABEL builder=true
WORKDIR /build
ADD go.mod .
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -o cmd/recipes/main cmd/recipes/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -o cmd/parser/main cmd/parser/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -o cmd/migrator/main cmd/migrator/main.go
FROM alpine
WORKDIR /build
COPY --from=builder /build/cmd/recipes/main /build/cmd/recipes/main
COPY --from=builder /build/cmd/migrator/main /build/cmd/migrator/main
COPY --from=builder /build/cmd/parser/main /build/cmd/parser/main
COPY --from=builder /build/config/* /build/config/
COPY --from=builder /build/migrations/* /build/migrations/
RUN touch start.sh
RUN echo "#!/bin/sh" >> start.sh
RUN echo "./cmd/migrator/main --migrations-path migrations" >> start.sh
RUN echo "./cmd/recipes/main" >> start.sh
RUN chmod +x start.sh
2024-01-31 10:08:51 +02:00
EXPOSE 80
2024-01-29 21:55:20 +02:00
CMD ["./start.sh"]