Last active
September 27, 2021 13:56
-
-
Save JesusTheHun/9ac789f856f71d666c4683ce019272a3 to your computer and use it in GitHub Desktop.
React, node, mysql docker compose setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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