Skip to content

Commit cf1d761

Browse files
ad todo list
1 parent 0f65355 commit cf1d761

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1813
-6
lines changed

.devcontainer/Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/devcontainers/python:0-3.10
2+
3+
ENV PYTHONUNBUFFERED 1
4+
5+
# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
6+
# COPY requirements.txt /tmp/pip-tmp/
7+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
8+
# && rm -rf /tmp/pip-tmp
9+
10+
#[Optional] Uncomment this section to install additional OS packages.
11+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
12+
&& apt-get -y install --no-install-recommends postgresql-client

.devcontainer/devcontainer.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/postgres
3+
{
4+
"name": "Python 3 & PostgreSQL",
5+
"dockerComposeFile": "docker-compose.yml",
6+
"service": "app",
7+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
8+
"customizations": {
9+
"vscode": {
10+
"settings": {
11+
"editor.defaultFormatter": "esbenp.prettier-vscode",
12+
"workbench.editorAssociations": {
13+
"*.md": "vscode.markdown.preview.editor"
14+
}
15+
},
16+
}
17+
},
18+
19+
// Features to add to the dev container. More info: https://containers.dev/features.
20+
// "features": {},
21+
22+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
23+
// This can be used to network with other containers or the host.
24+
"forwardPorts": [5432],
25+
26+
"onCreateCommand": "cp -n .env.example .env && pipenv install",
27+
28+
// Use 'postCreateCommand' to run commands after the container is created.
29+
"postCreateCommand": "pipenv install && bash database.sh && python docs/assets/welcome.py",
30+
31+
// Configure tool-specific properties.
32+
// "customizations": {},
33+
34+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
35+
// "remoteUser": "root"
36+
}

.devcontainer/docker-compose.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: '3.8'
2+
3+
services:
4+
app:
5+
build:
6+
context: ..
7+
dockerfile: .devcontainer/Dockerfile
8+
9+
volumes:
10+
- ../..:/workspaces:cached
11+
12+
# Overrides default command so things don't shut down after the process ends.
13+
command: sleep infinity
14+
15+
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
16+
network_mode: service:db
17+
18+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
19+
# (Adding the "ports" property to this file will not forward from a Codespace.)
20+
21+
db:
22+
image: postgres:latest
23+
restart: unless-stopped
24+
volumes:
25+
- postgres-data:/var/lib/postgresql/data
26+
environment:
27+
POSTGRES_USER: gitpod
28+
POSTGRES_DB: example
29+
POSTGRES_PASSWORD: postgres
30+
31+
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
32+
# (Adding the "ports" property to this file will not forward from a Codespace.)
33+
34+
volumes:
35+
postgres-data:

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DATABASE_URL=postgresql://gitpod:postgres@localhost:5432/example
2+
FLASK_APP_KEY="any key works"
3+
FLASK_APP=src/app.py
4+
FLASK_DEBUG=1

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.env
2+
.venv
3+
database.database
4+
database.db
5+
diagram.png
6+
public/*
7+
dist/*
8+
package.json
9+
!.vscode
10+
__pycache__/

.gitpod.Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM gitpod/workspace-postgres:latest
2+
3+
SHELL ["/bin/bash", "-c"]
4+
5+
RUN sudo apt-get update \
6+
&& sudo apt-get update \
7+
&& sudo apt-get clean \
8+
&& sudo rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/*
9+
10+
# That Gitpod install pyenv for me? no, thanks
11+
WORKDIR /home/gitpod/
12+
RUN rm .pyenv -Rf
13+
RUN rm .gp_pyenv.d -Rf
14+
RUN curl https://pyenv.run | bash
15+
16+
17+
RUN pyenv update && pyenv install 3.10.7 && pyenv global 3.10.7
18+
RUN pip install pipenv
19+
RUN npm i heroku -g
20+
21+
# remove PIP_USER environment
22+
USER gitpod
23+
RUN if ! grep -q "export PIP_USER=no" "$HOME/.bashrc"; then printf '%s\n' "export PIP_USER=no" >> "$HOME/.bashrc"; fi
24+
RUN echo "" >> $HOME/.bashrc
25+
RUN echo "unset DATABASE_URL" >> $HOME/.bashrc
26+
RUN echo "export DATABASE_URL" >> $HOME/.bashrc

.gitpod.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
image:
2+
file: .gitpod.Dockerfile
3+
ports:
4+
- port: 3000
5+
onOpen: open-preview
6+
visibility: public
7+
- port: 3306
8+
onOpen: ignore
9+
visibility: public
10+
tasks:
11+
- init: >
12+
(cp -n .env.example .env || true) &&
13+
pipenv install &&
14+
psql -U gitpod -c 'CREATE DATABASE example;' &&
15+
psql -U gitpod -c 'CREATE EXTENSION unaccent;' -d example &&
16+
psql -c "ALTER USER gitpod PASSWORD 'postgres';" &&
17+
bash database.sh &&
18+
python docs/assets/welcome.py
19+
command: >
20+
pipenv run start;
21+
22+
github:
23+
prebuilds:
24+
# enable for the master/default branch (defaults to true)
25+
main: false

0 commit comments

Comments
 (0)