-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (34 loc) · 1.1 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
FROM node:18-alpine AS client-builder
# Adding pnpm and git
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apk add --no-cache git
# Cloning the client repository
RUN git clone https://github.com/nilotpaul/go-downloader-client /client
WORKDIR /client
RUN pnpm install
# Build will generate a bundled static folder dist
RUN pnpm build
FROM golang:1.22-alpine AS server-builder
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Copying the dist directory from previous client stage
COPY --from=client-builder /client/dist ./dist
RUN go build -tags '!dev' -o bin/go-downloader
FROM alpine:latest
RUN apk add --no-cache ca-certificates
WORKDIR /root/
ENV ENVIRONMENT="PROD"
ENV PORT="3000"
ENV REDIRECT_AFTER_LOGIN="/settings"
ENV REDIRECT_AFTER_LOGOUT="/"
# Copying the dist and go binary from previous stages
COPY --from=server-builder /app/bin ./bin
COPY --from=server-builder /app/dist ./dist
COPY --from=server-builder /app/migrations ./migrations
EXPOSE 3000
CMD [ "./bin/go-downloader" ]