This repository was archived by the owner on Sep 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 108
Add basic support for Docker, both for development and deploy #261
Open
starnutoditopo
wants to merge
2
commits into
gpxstudio:master
Choose a base branch
from
starnutoditopo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,7 @@ | ||
FROM python:3.12.0-alpine3.17 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# In Visual Studio Code: | ||
# edit ./res/config.json and set your API keys | ||
# open a terminal and run: | ||
# python3 -m http.server | ||
This file contains hidden or 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,55 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/dotnet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you base it on the dotnet template? (also commented out configs further below) Would the python3 template make more sense? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just used an image to let me debug. |
||
{ | ||
"name": "Python 3.9", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "..", | ||
"args": { | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": {}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker" | ||
] | ||
} | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [5000, 5001], | ||
// [Optional] To reuse of your local HTTPS dev cert: | ||
// | ||
// 1. Export it locally using this command: | ||
// * Windows PowerShell: | ||
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" | ||
// * macOS/Linux terminal: | ||
// dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" | ||
// | ||
// 2. Uncomment these 'remoteEnv' lines: | ||
// "remoteEnv": { | ||
// "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere", | ||
// "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx", | ||
// }, | ||
// | ||
// 3. Do one of the following depending on your scenario: | ||
// * When using GitHub Codespaces and/or Remote - Containers: | ||
// 1. Start the container | ||
// 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer | ||
// 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https" | ||
// | ||
// * If only using Remote - Containers with a local container, uncomment this line instead: | ||
// "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "dotnet restore", | ||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
//"remoteUser": "vscode" | ||
"remoteUser": "root" | ||
// See: https://code.visualstudio.com/docs/remote/containers-advanced | ||
//"mounts": [ | ||
// "source=${localWorkspaceFolder}/../Documentation,target=/Documentation,type=bind" | ||
//], | ||
} |
This file contains hidden or 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,19 @@ | ||
FROM python:3.12.0-alpine3.17 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
RUN apk update \ | ||
&& apk add jq | ||
|
||
WORKDIR /gpxstudio | ||
COPY . . | ||
|
||
RUN chmod +x run.sh | ||
|
||
CMD ["./run.sh"] | ||
|
||
# Build: | ||
# docker build -t gpxstudio . | ||
# | ||
# Run: | ||
# docker run -it --rm -p 8000:8000 -e mapboxApiKey=123 -e openAipKey=xyz -e routing_url=https://routing.gpx.studio gpxstudio | ||
# open your browser at http://localhost:8000 |
This file contains hidden or 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 hidden or 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 hidden or 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,23 @@ | ||
#!/bin/sh | ||
|
||
if [ -z "$mapboxApiKey" ] | ||
then | ||
echo "Please set \$mapboxApiKey" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$openAipKey" ] | ||
then | ||
echo "Please set \$openAipKey" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$routing_url" ] | ||
then | ||
echo "Please set \$routing_url" | ||
exit 1 | ||
fi | ||
|
||
echo "mapboxApiKey is: $mapboxApiKey" | ||
jq '.mapbox = "'$mapboxApiKey'" | .mapbox_dev = "'$mapboxApiKey'" | .openaip = "'$openAipKey'" | .routing_url = "'$routing_url'"' ./res/config.json > ./res/config_new.json && mv ./res/config_new.json ./res/config.json | ||
python3 -m http.server |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could use
postStartCommand
https://code.visualstudio.com/remote/advancedcontainers/start-processesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sounds good!