diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..444ba69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Build the UI +FROM node:18.17.0-bullseye-slim AS nodework +WORKDIR /app +COPY ui/ . +RUN npm install +RUN npm run build + +# Build the Go binary +FROM golang:1.22 AS gowork +WORKDIR /app +COPY go.mod . +COPY go.sum . +RUN go mod download + +COPY . . +COPY --from=nodework /app/build ui/build +RUN go build -o /app/main . + + +# Run the binary in a alpine container +FROM ubuntu:22.04 +WORKDIR /app +COPY --from=gowork /app/main . +CMD [ "./main" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..eb425c3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + server: + image: go-fast-cdn + build: . + ports: + - "8080:8080" + volumes: + - uploads:/app/uploads + - db_data:/app/db_data + container_name: go-fast-cdn +volumes: + db_data: + uploads: