Skip to content

Instantly share code, notes, and snippets.

@Rafat97
Last active February 7, 2022 16:27
Show Gist options
  • Save Rafat97/143e74ecbde712003e72d68015333204 to your computer and use it in GitHub Desktop.
Save Rafat97/143e74ecbde712003e72d68015333204 to your computer and use it in GitHub Desktop.
🐳🐳 Docker Compose django & python 🐳🐳

🐳🐳 Dockerfile & Docker Compose React 🐳🐳

version: "3.3"
networks:
react-frontend-network:
services:
# web:
# build:
# context: .
# dockerfile: ./Dockerfile_create_react_app.DEV
# command: yarn run start
# container_name: react-frontend-app
# image: react-frontend-app-dev:v1
# restart: always
# volumes:
# - ./:/usr/src/app
# - /usr/src/app/node_modules
# ports:
# - "3000:3000"
# networks:
# - react-frontend-network
web-prod:
build:
context: .
dockerfile: ./Dockerfile_create_react_app.PROD
container_name: react-frontend-app
image: react-frontend-app-prod:v1
restart: always
ports:
- "3000:80"
networks:
- react-frontend-network
FROM node:lts-alpine
RUN apk add --no-cache libc6-compat
ENV NODE_ENV development
WORKDIR /usr/src/app
COPY ./package.json /usr/src/app/
RUN yarn install --frozen-lockfile
EXPOSE 3000
FROM node:lts-alpine as build
RUN apk add --no-cache libc6-compat
WORKDIR /app/code
COPY . /app/code
RUN yarn install --frozen-lockfile
RUN yarn run build
FROM nginx:stable-alpine
COPY --from=build /app/code/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment