Skip to content

Commit

Permalink
build: Actualiza creación de contenedores
Browse files Browse the repository at this point in the history
* # This is a combination of 6 commits.
# This is the 1st commit message:

build: Actualiza creacion de contenedor@

Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>

# The commit message #2 will be skipped:

# build: Reoganiza archivos de dependencias
#
# Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>

# The commit message #3 will be skipped:

# build: Actualiza version de python en contenedor
#
# Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>

# The commit message #4 will be skipped:

# refactor: Actualiza docker entry-point
#
# Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>

# The commit message #5 will be skipped:

# build: Elimina archivo de configuracion de Heroku

# The commit message #6 will be skipped:

# build: Actualiza creacion de contenedores
#
# Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>

* build: Update docker build

Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>

* build: Actualiza creacion de contenedor@

Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>

* build: Actualiza Dockerfile

* ci: Actualiza ci
  • Loading branch information
williamjmorenor committed Mar 9, 2021
1 parent 3ac545d commit 61308a6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ jobs:
- name: Crear Contedor
run: |
buildah bud -t cacao-image .
- name: Probar Contenedor
- name: Ejecutar Contenedor
run: |
podman images
podman pod create --name cacao-pod
podman volume create cacao-database
podman pull mysql
podman run --name cacaodb -e MYSQL_ROOT_PASSWORD=cacadb -e MYSQL_DATABASE=cacaodb -e MYSQL_USER=cacaodb -e MYSQL_PASSWORD=cacaodb -p 3306:3306 -d mysql
podman run --name cacao -p 8080:8080 -d -e CACAO_ACCOUNTING=True -e CACAO_KEY=nsjksldknsdlkdsljdn -e CACAO_DB=mysql+pymysql://cacaodb:cacaodb@localhost:3306/cacaodb localhost/cacao-image
curl http://127.0.0.1:8080
podman run --pod cacao-pod --restart on-failure --volume cacao-database:/var/lib/mysql --name cacaodb -e MYSQL_ROOT_PASSWORD=cacaodb -e MYSQL_DATABASE=cacaodb -e MYSQL_USER=cacaodb -e MYSQL_PASSWORD=cacaodb -d mysql
podman run --pod cacao-pod --name cacao -e CACAO_ACCOUNTING=True -e CACAO_KEY=nsjksldknsdlkdsljdn -e CACAO_DB=mysql+pymysql://cacaodb:cacaodb@localhost:3306/cacaodb -d localhost/cacao-image
podman container ls
- name: Probar Contenedor
run: |
sleep 5
podman container ls
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ RUN /usr/local/bin/python3 -m pip --no-cache-dir install -r /tmp/requirements.tx
# Copy and install app
COPY . /app
WORKDIR /app
RUN pwd
RUN ls
RUN chmod +x docker-entry-point
RUN cp docker-entry-point.sh /usr/local/bin/docker-entry-point && chmod +x /usr/local/bin/docker-entry-point

# Install nodejs modules in the final docker image
COPY --from=js node_modules /app/cacao_accounting/static/node_modules
Expand All @@ -37,4 +35,4 @@ USER cacao

EXPOSE 8080
ENTRYPOINT [ "/bin/sh" ]
CMD /app/docker-entry-point
CMD [ "/usr/local/bin/docker-entry-point" ]
4 changes: 2 additions & 2 deletions cacao_accounting/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
else:
configuracion = {}
if DOCKERISED or "DYNO" in environ or "CACAO_ACCOUNTING" in environ:
configuracion["SQLALCHEMY_DATABASE_URI"] = environ["SQLALCHEMY_DATABASE_URI"] or environ["CACAO_DB"]
configuracion["SECRET_KEY"] = environ["SECRET_KEY"] or environ["CACAO_KEY"]
configuracion["SQLALCHEMY_DATABASE_URI"] = environ["CACAO_DB"]
configuracion["SECRET_KEY"] = environ["CACAO_KEY"]
configuracion["DESKTOPMODE"] = False
configuracion["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
elif DEVELOPMENT or ("CACAO_TESTING" in environ) or ("CI" in environ):
Expand Down
6 changes: 6 additions & 0 deletions docker-entry-point.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -e

cacaoctl initdb
cacaoctl serve
4 changes: 4 additions & 0 deletions docs/despliegue.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ Cacao Accounting es software en desarrollo no apto aún para su uso en producci

## Docker

[![Contenedores](https://github.com/cacao-accounting/cacao-accounting/actions/workflows/container.yml/badge.svg)](https://github.com/cacao-accounting/cacao-accounting/actions/workflows/container.yml)
[![Docker Repository on Quay](https://quay.io/repository/cacaoaccounting/cacaoaccounting/status "Docker Repository on Quay")](https://quay.io/repository/cacaoaccounting/cacaoaccounting)


Existe una imagen de imagen de contenedor disponible para ejecutar la aplicación en:

```bash
Expand Down

0 comments on commit 61308a6

Please sign in to comment.