diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..44c8845 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# build react +FROM node:20-alpine AS build_react_stage + +RUN mkdir -p /home/react +WORKDIR /home/react + +COPY client/package.json ./ +RUN npm install + +COPY client/ ./ +ARG REACT_APP_BACKEND_URL +ENV REACT_APP_BACKEND_URL=${REACT_APP_BACKEND_URL} +RUN npm run build + +# build go +FROM golang:1.21.6 + +WORKDIR /home/seek-tune + +COPY server/go.mod server/go.sum ./ +RUN go mod download + +COPY server/ ./ +ENV ENV=production + +RUN mkdir -p static +COPY --from=build_react_stage /home/react/build static + +RUN go build -o seek-tune + +EXPOSE 5000 + +CMD [ "/home/seek-tune/seek-tune", "serve" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5e2bcd3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.1' +services: + seek-tune: + image: 'seek-tune' + restart: unless-stopped + ports: + - 8080:5000 + + environment: + DB_TYPE: ${DB_TYPE:-sqlite} + DB_USER: ${DB_USER:-root} + DB_PASSWORD: ${DB_PASSWORD:-password} + DB_NAME: ${DB_NAME:-seek_tune_db} + DB_HOST: ${DB_HOST:-localhost} + DB_PORT: ${DB_PORT:-27017} + + REACT_APP_BACKEND_URL: ${REACT_APP_BACKEND_URL:-http://localhost:8080} + + build: + context: . + args: + REACT_APP_BACKEND_URL: ${REACT_APP_BACKEND_URL:-http://localhost:8080} + + volumes: + - ./songs:/home/seek-tune/songs + - ./db:/home/seek-tune/db \ No newline at end of file