-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (38 loc) · 1.42 KB
/
Dockerfile
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
50
51
52
53
54
55
56
57
58
# syntax=docker/dockerfile:1
FROM golang:1.23.2-alpine AS golang
FROM oven/bun:1.1.31-alpine AS builder
COPY --from=golang /usr/local/go/ /usr/local/go/
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
ENV PATH="$PATH:/usr/local/go/bin"
ENV OS="linux"
ENV PROD="true"
RUN apk update
RUN apk add git
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
RUN git clone https://github.com/JakubCzarlinski/svelte-ssr /app/build/render
RUN git clone https://github.com/JakubCzarlinski/svelte-ssr-to-templ /app/build/render_to_templ
RUN go -C /app/build/render_to_templ/ mod download
WORKDIR /app
COPY package.json /app/package.json
RUN bun install
COPY ./project/go.mod /app/project/go.mod
COPY ./project/go.sum /app/project/go.sum
RUN go -C /app/project mod download
COPY ./build/builder/go.mod /app/build/builder/go.mod
COPY ./build/builder/go.sum /app/build/builder/go.sum
RUN go -C /app/build/builder mod download
COPY . /app
RUN go -C /app/build/render_to_templ/ build -ldflags="-s -w" -o ./main.exe ./cmd/main.go
RUN go -C /app/build/builder/ build -ldflags="-s -w" -o ./build.exe ./build.go
RUN /app/build/builder/build.exe
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/main.exe /app/main.exe
ENV OS="linux"
ENV PROD="true"
EXPOSE 3000
ENTRYPOINT [ "./main.exe" ]