-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from CorreiaEduardo/feature/dockerfile
Feature/dockerfile
- Loading branch information
Showing
6 changed files
with
63 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM ubuntu:latest | ||
|
||
COPY . /app | ||
|
||
WORKDIR /app | ||
|
||
RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install necessary packages | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
ca-certificates \ | ||
curl | ||
|
||
# Install Python 3.11 | ||
RUN apt-get install build-essential dos2unix python3-full python3-dev libpq-dev -y | ||
|
||
# Configure Poetry | ||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_CREATE=false \ | ||
POETRY_CACHE_DIR='/var/cache/pypoetry' \ | ||
POETRY_HOME='/usr/local' \ | ||
POETRY_VERSION=1.5.1 | ||
|
||
# System deps: | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# Install dependencies with poetry | ||
RUN poetry install --no-root | ||
|
||
# Startup | ||
ENV FLASK_APP=plasticome_metadata.routes.app.py | ||
CMD [ "flask", "run" , "-h", "metadata"] |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Esperando o PostgreSQL iniciar..." | ||
sleep 5 | ||
|
||
apt-get update && apt-get install -y lzop | ||
|
||
if [ -f /dump/plasticome-psql-v1.sql.lzo ]; then | ||
echo "Descompactando o dump..." | ||
lzop -d /dump/plasticome-psql-v1.sql.lzo -c > /dump/plasticome-psql-v1.sql | ||
echo "Restaurando o banco de dados a partir do dump..." | ||
psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -f /dump/plasticome-psql-v1.sql | ||
echo "Restauração do banco de dados concluída!" | ||
|
||
else | ||
echo "Dump não encontrado em /dump/plasticome-psql-v1.sql.lzo" | ||
fi |