-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (31 loc) · 904 Bytes
/
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
FROM node:latest as assets
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
COPY postcss.config.cjs ./
COPY fonts.css ./
RUN mkdir -p app/static/css app/static/fonts
RUN npm install --ci
RUN npm run fonts
RUN npm run tailwind-build
# Define the "base" stage
FROM golang:latest as base
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY . .
# Define the "dev" stage
FROM base as app-dev
RUN curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
WORKDIR /app
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN templ generate
CMD ["air"]
# Define the final stage
FROM base as final
COPY --from=assets /app/controller/static/css/* ./controller/static/css/
COPY --from=assets /app/controller/static/fonts/* ./controller/static/fonts/
RUN CGO_ENABLED=0 go build -o /app/server
EXPOSE 6969
ENTRYPOINT ["/app/server"]