-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
131 additions
and
0 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 @@ | ||
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm |
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,10 @@ | ||
{ | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".." | ||
}, | ||
"features": { | ||
"ghcr.io/defanglabs/devcontainer-feature/defang-cli:1.0.4": {}, | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {} | ||
} | ||
} |
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,27 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Deploy | ||
uses: DefangLabs/[email protected] | ||
#REMOVE_ME_AFTER_EDITING - Replace the following line with the list of environment variables you want to pass to the action | ||
# or remove the lines if you don't need to pass any environment variables/secrets to the action | ||
with: | ||
config-env-vars: ENV1 ENV2 | ||
env: | ||
ENV1: ${{ secrets.ENV1 }} | ||
ENV2: ${{ secrets.ENV2 }} |
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,54 @@ | ||
# Starter Sample #REMOVE_ME_AFTER_EDITING | ||
|
||
[1-click deploy](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-<YOUR_SAMPLE_DIR#REMOVE_ME_AFTER_EDITING>-template%26template_owner%3DDefangSamples) | ||
|
||
This is a sample that shows the rough structure of an actual Defang sample. This top paragraph should give a bit of context about the project and what it does. The rest of the README should be a guide on how to use the sample. #REMOVE_ME_AFTER_EDITING | ||
|
||
## Prerequisites | ||
|
||
1. [!NOTE] Download [Defang CLI](https://github.com/DefangLabs/defang) | ||
2. (Optional) If you are using [Defang BYOC](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) authenticated with your AWS account | ||
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/) | ||
|
||
## Development | ||
|
||
To run the application locally, you can use the following command: | ||
|
||
```bash | ||
# This might be `docker compose -f compose.dev.yaml up` depending on the project. #REMOVE_ME_AFTER_EDITING | ||
docker compose up | ||
``` | ||
|
||
## Configuration | ||
#REMOVE_ME_AFTER_EDITING - this section should be removed if there are no configuration values needed. The intro text can probably stay, but the list of configuration values should be updated/removed if there are none. | ||
|
||
For this sample, you will need to provide the following [configuration](https://docs.defang.io/docs/concepts/configuration). Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you. | ||
|
||
### `API_KEY` #REMOVE_ME_AFTER_EDITING | ||
An explanation of what the env var (`API_KEY`) is, etc. | ||
|
||
## Deployment | ||
|
||
> [!NOTE] | ||
> Download [Defang CLI](https://github.com/DefangLabs/defang) | ||
### Defang Playground | ||
|
||
Deploy your application to the defang playground by opening up your terminal and typing `defang up`. | ||
|
||
### BYOC (AWS) | ||
|
||
If you want to deploy to your own cloud account, you can use Defang BYOC: | ||
|
||
1. [Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`. | ||
2. Run `defang up` in a terminal that has access to your AWS environment variables. | ||
|
||
--- | ||
|
||
Title: Sample Title #REMOVE_ME_AFTER_EDITING | ||
|
||
Short Description: A short sentence or two describing the sample. #REMOVE_ME_AFTER_EDITING | ||
|
||
Tags: Tags, That, Are, Not, Programming, Languages #REMOVE_ME_AFTER_EDITING | ||
|
||
Languages: Programming, Languages, Used #REMOVE_ME_AFTER_EDITING |
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,2 @@ | ||
node_modules | ||
npm-debug.log |
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 @@ | ||
node_modules |
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,15 @@ | ||
FROM ubuntu:22.04 | ||
|
||
# install curl | ||
RUN apt-get update && apt-get install -y curl && apt-get clean | ||
|
||
# create ollama user and group | ||
RUN groupadd -r ollama && useradd -r -g ollama ollama | ||
|
||
RUN curl -fsSL https://ollama.com/install.sh | sh | ||
|
||
COPY ./run /run | ||
|
||
USER ollama | ||
|
||
CMD ["/run"] |
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,4 @@ | ||
#!/bin/bash | ||
|
||
ollama pull llama3.2:1b | ||
|
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,17 @@ | ||
# Sample compose file. #REMOVE_ME_AFTER_EDITING | ||
|
||
services: | ||
app: | ||
# uncomment to add your own domain | ||
# domainname: example.com | ||
build: | ||
context: ./app | ||
dockerfile: Dockerfile | ||
ports: | ||
- target: 3000 | ||
published: 3000 | ||
mode: ingress | ||
healthcheck: | ||
# wget or curl required for healthchecks on services with a published port | ||
# this gets parsed by Defang and provided to the load balancers as well | ||
test: [ "CMD", "curl", "-s", "http://localhost:3000/" ] |