-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (33 loc) · 1.08 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
FROM golang:1.17-alpine AS gobuilder
LABEL maintainer="Julian Beck <[email protected] (https://juli.sh/)"
# Move to working directory (/build).
WORKDIR /build
# Copy and download dependency using go mod.
COPY go.mod go.sum ./
RUN go mod download
# Copy the code into the container.
COPY internal/ ./internal
COPY main.go ./
COPY go.mod go.sum ./
# Set necessary environment variables needed for our image and build the API server.
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -ldflags="-s -w" -o pistock .
FROM node:17.7.1-alpine as nodebuilder
# set working directory
WORKDIR /app
# install dependencies
COPY frontend/package.json frontend/tsconfig.json ./
COPY frontend/package-lock.json ./
RUN npm install --silent
# copy the code into the container
COPY frontend/src ./src
COPY frontend/public ./public
RUN npm run build
FROM alpine:latest
# Move Files from build steps into the container
COPY --from=gobuilder ["/build/pistock", "/"]
COPY --from=nodebuilder ["/app/build/", "/frontend/build"]
COPY website.yaml ./
ENTRYPOINT ["/pistock"]