se comenta en readme.md dockerfile y docker-compose.yml para produccion
parent
51d6b6dd06
commit
f31618fa19
72
readme.md
72
readme.md
|
@ -1,5 +1,73 @@
|
|||
|
||||
# file: docker-compose.yml
|
||||
|
||||
# file: Dockerfile (produccion)
|
||||
|
||||
~~~docker
|
||||
# seccion frontend
|
||||
FROM node:20-alpine as frontend
|
||||
ARG gitusername
|
||||
ARG gitpassword
|
||||
|
||||
# soluciona error en descarga de repositorio
|
||||
RUN sed -i 's/https\:\/\//http\:\/\//g' /etc/apk/repositories
|
||||
|
||||
# descargar proyecto
|
||||
RUN apk update && apk add git
|
||||
RUN git clone "https://${gitusername}:${gitpassword}@gitlab.com/m3f_usm/paraderos/frontend" /frontend
|
||||
RUN git clone "https://${gitusername}:${gitpassword}@gitlab.com/m3f_usm/paraderos/backend" /backend
|
||||
RUN rm -rf /backend/project/dist
|
||||
|
||||
# compilar
|
||||
WORKDIR /frontend
|
||||
RUN npm install --legacy-peer-deps && npm run build
|
||||
|
||||
# seccion final -- se omite git y archivos innecerarios para reducir imagen
|
||||
FROM python:3.11-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=frontend /backend/project/ /app/project
|
||||
COPY --from=frontend /backend/app/ /app/app
|
||||
COPY --from=frontend /backend/readme.md /app
|
||||
COPY --from=frontend /backend/manage.py /app
|
||||
COPY --from=frontend /backend/requirements.txt /app
|
||||
COPY --from=frontend /frontend/dist/ /app/project/dist
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
ENTRYPOINT ["python3"]
|
||||
CMD [ "/app/manage.py", "runserver", "0.0.0.0:4001" ]
|
||||
~~~
|
||||
|
||||
|
||||
# Instrucciones para compilar imagen docker
|
||||
|
||||
~~~shell
|
||||
docker build -t <tagname:version> -f Dockerfile --no-cache --build-arg gitusername=<usuario gitlab> --build-arg gitpassword=<password gitlab> .
|
||||
|
||||
# ejemplo
|
||||
# docker build -t paradero:v1.2 -f Dockerfile --no-cache --build-arg gitusername=johndoe --build-arg gitpassword=mypassword .
|
||||
~~~
|
||||
|
||||
|
||||
# file: docker-compose.yml (produccion)
|
||||
|
||||
~~~yml
|
||||
version: '3'
|
||||
name: paradero
|
||||
|
||||
services:
|
||||
|
||||
app:
|
||||
image: paradero:v20240310
|
||||
environment:
|
||||
- TRANSPORTE_API=https://transporte.hz.kursor.cl/api
|
||||
- TRANSPORTE_USER=11111111-1
|
||||
- TRANSPORTE_PASS=usuario1
|
||||
ports:
|
||||
- 4001:4001
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
# file: docker-compose.yml (desarrollo)
|
||||
|
||||
~~~yml
|
||||
version: '3'
|
||||
|
@ -12,7 +80,7 @@ services:
|
|||
environment:
|
||||
- PORT=4001
|
||||
- TRANSPORTE_API=https://transporte.hz.kursor.cl/api
|
||||
- TRANSPORTE_USER=usuario1
|
||||
- TRANSPORTE_USER=11111111-1
|
||||
- TRANSPORTE_PASS=usuario1
|
||||
ports:
|
||||
- 4001:4001
|
||||
|
|
Loading…
Reference in New Issue