Skip to content

Commit

Permalink
feat: dockerized plakplaats
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasPeters committed May 14, 2024
1 parent 04055c4 commit 27cbd1b
Show file tree
Hide file tree
Showing 29 changed files with 58 additions and 85 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:latest
WORKDIR /home/plakplaats

# Copy the files responsible for listing dependencies
COPY requirements.txt ./

# Cache the dependencies
RUN pip install -r requirements.txt --no-cache-dir

# Copy over everything
COPY . .

EXPOSE 3000
CMD ["python", "src/server.py"]
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Plakplaats devcontainer",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
"dockerfile": "Dockerfile"
},
"forwardPorts": [
3000
],
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-azuretools.vscode-docker"
]
}
}
}
82 changes: 0 additions & 82 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,83 +1 @@
.env

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# .NET
obj/
bin/
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:alpine
WORKDIR /home/plakplaats

# Copy the files responsible for listing dependencies
COPY requirements.txt ./

# Cache the dependencies
RUN apk add --no-cache postgresql-libs && \
apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev
RUN python3 -m pip install -r requirements.txt --no-cache-dir
RUN apk --purge del .build-deps

# Copy the source code
COPY src src

EXPOSE 3000
CMD ["python", "src/server.py"]
2 changes: 0 additions & 2 deletions dependencies.md

This file was deleted.

5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
flask
waitress
requests
psycopg2
python-dotenv
2 changes: 1 addition & 1 deletion server.py → src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,4 @@ def checkFileName(name):
# only runs when executed as script, not when used as module
if __name__ == "__main__":
from waitress import serve
serve(app, host='0.0.0.0', port='7050')
serve(app, host='0.0.0.0', port='3000')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 27cbd1b

Please sign in to comment.