This commit is contained in:
parent
6498ac56d9
commit
92f6a89f25
20
Dockerfile
20
Dockerfile
|
@ -1,14 +1,6 @@
|
|||
# Load the golang image
|
||||
FROM golang:1.21.0 as go-builder
|
||||
# Then the node image
|
||||
FROM node:20.5.0 as builder
|
||||
# Load nodego image
|
||||
FROM maronato/nodego:1.0 as builder
|
||||
|
||||
# Copy golang into the node image
|
||||
COPY --from=go-builder /usr/local/go /usr/local/go
|
||||
|
||||
# Now our base image is ready.
|
||||
|
||||
# Continue as normal
|
||||
WORKDIR /go/src/app
|
||||
|
||||
# Set our build environment
|
||||
|
@ -22,8 +14,6 @@ ENV ENV_DOCKER=true
|
|||
# Copy dockerignore files
|
||||
COPY .dockerignore ./
|
||||
|
||||
COPY Makefile ./
|
||||
|
||||
# Install go deps using the cache
|
||||
COPY go.mod go.sum ./
|
||||
RUN --mount=type=cache,target=/tmp/.go-build-cache \
|
||||
|
@ -33,11 +23,11 @@ RUN --mount=type=cache,target=/tmp/.go-build-cache \
|
|||
COPY frontend/package.json frontend/package-lock.json frontend/
|
||||
RUN npm config set cache /tmp/.npm-cache --global
|
||||
RUN --mount=type=cache,target=/tmp/.npm-cache \
|
||||
make install
|
||||
npm ci --prefix frontend
|
||||
|
||||
# Build the frontend
|
||||
COPY frontend frontend
|
||||
RUN make frontend
|
||||
RUN VITE_API_URL=/api npm run --prefix frontend build
|
||||
|
||||
# Build backend
|
||||
COPY goshort.go ./
|
||||
|
@ -46,7 +36,7 @@ COPY internal internal
|
|||
|
||||
# Build the backend
|
||||
RUN --mount=type=cache,target=/tmp/.go-build-cache \
|
||||
make backend
|
||||
CGO_ENABLED=0 go build -o goshort goshort.go
|
||||
|
||||
# Now create a new image with just the binary
|
||||
FROM gcr.io/distroless/static-debian11:nonroot
|
||||
|
|
Loading…
Reference in New Issue
Block a user