feat: add Dockerfile and docker-compose.yml for application setup

This commit is contained in:
Chigozirim Igweamaka 2025-04-07 02:29:40 +01:00
parent cd231fe6a8
commit e740795f46
2 changed files with 59 additions and 0 deletions

33
Dockerfile Normal file
View file

@ -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" ]

26
docker-compose.yml Normal file
View file

@ -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