-
Notifications
You must be signed in to change notification settings - Fork 62
/
Dockerfile
41 lines (30 loc) · 906 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
35
36
37
38
39
40
41
FROM node:18-alpine as nodebuilder
LABEL stage=nodebuilder
# Set the working directory to /app
WORKDIR /web
# Copy the current directory contents into the container at /web
COPY package.json /web/
# Install any needed packages
RUN npm cache clear --force
RUN npm install
COPY . /web/
# build and remove front source code
ENV NODE_OPTIONS=--max_old_space_size=2048
RUN npm run build
FROM golang:1.21-alpine AS gobuilder
LABEL stage=gobuilder
ENV CGO_ENABLED 1
ENV GOOS linux
WORKDIR /server
COPY server .
COPY --from=nodebuilder /web/dist/ /server/api/studio/assets
RUN go mod download
RUN apk add build-base
RUN go build -ldflags="-s -w" -o /server/server /server/api/studio/studio.go
FROM alpine
WORKDIR /app
COPY --from=gobuilder /server/server /app/server
COPY --from=gobuilder /server/api/studio/etc /app/etc/
RUN sed -i "s/9000/7001/g" /app/etc/studio-api.yaml
EXPOSE 7001
CMD ["./server"]