Skip to content

Instantly share code, notes, and snippets.

@TheOnlyWayUp
Last active February 10, 2024 22:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheOnlyWayUp/f8733c272090e78e00b9891d2a709117 to your computer and use it in GitHub Desktop.
Save TheOnlyWayUp/f8733c272090e78e00b9891d2a709117 to your computer and use it in GitHub Desktop.
Dockerfile for projects with Python Backends and Javascript Frontends. Star if useful, thanks!
FROM node:20
WORKDIR /build
COPY src/frontend/package*.json .
RUN rm -rf node_modules
RUN rm -rf build
RUN npm install
COPY src/frontend/. .
RUN npm run build
# Thanks https://stackoverflow.com/q/76988450
FROM python:3.10-slim
WORKDIR /app
COPY src/api/requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY --from=0 /build/build /app/build
COPY src/api/src/.env .env
COPY src/api/src .
EXPOSE 80
ENV PORT=80
CMD [ "python3", "main.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment