Hi, I am pretty new to using docker and I was trying to follow a guide online but for some reason, I am not able to get my server up and running with a go backend and react frontend. Here is my dockerfile:
# Build the Go API FROM golang:latest AS builder ADD . /app WORKDIR /app/server RUN go mod download RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w" -a -o /main . # Build the React application FROM node:alpine AS node_builder COPY --from=builder /app/client . RUN npm install RUN npm run build # Final stage build, this will be the container # that we will deploy to production FROM alpine:latest RUN apk --no-cache add ca-certificates COPY --from=builder /main . COPY --from=node_builder /build ./web RUN chmod +x ./main EXPOSE 8080 CMD ./main
here is my filesystem structure:
project | |-client/ |-server/ |-Dockerfile
when I run my docker image doing:
$ docker build -t react-go . $ docker run -p 3000:8080 -d react-go
But after I do all this I go to localhost:3000 and get a 404… Any Ideas???