Skip to content

Instantly share code, notes, and snippets.

@JesusTheHun
Last active September 27, 2021 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JesusTheHun/9ac789f856f71d666c4683ce019272a3 to your computer and use it in GitHub Desktop.
Save JesusTheHun/9ac789f856f71d666c4683ce019272a3 to your computer and use it in GitHub Desktop.
React, node, mysql docker compose setup
version: '3.5'
services:
client:
image: client
ports:
- "3000:3000"
api:
image: server
volumes:
- ./data/filestorage:/opt/files
ports:
- "8080:8080"
mysql:
image: mysql:8
environment:
- MYSQL_ROOT_PASSWORD=thibaut
- MYSQL_DATABASE=groupomania_social
ports:
- "3306:3306"
FROM node:12.15.0-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
RUN apk --no-cache upgrade && apk --no-cache add alpine-sdk python2 libtool autoconf automake git
COPY . ./
RUN npm ci
ENV NODE_ENV production
RUN npm run build
FROM node:12.15.0-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
RUN npm install -g serve
COPY --from=build /app/build ./build/
EXPOSE 3000
CMD serve -s build -l 3000
FROM node:14
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 8080
CMD [ "node", "server.js" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment