Skip to content

Commit 1eded54

Browse files
committed
Merge branch 'main' of https://github.com/DefangLabs/samples into unify-python
2 parents 9cfb674 + 121953f commit 1eded54

File tree

32 files changed

+399
-72
lines changed

32 files changed

+399
-72
lines changed

samples/angular-express/backend/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Use the official Node.js image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js v20 on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Create and change to the app directory
55
WORKDIR /app
@@ -15,3 +15,6 @@ COPY . .
1515

1616
# Expose the port the app runs on
1717
EXPOSE 3000
18+
19+
# Define the command to run your application
20+
CMD ["npm", "start"]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Use the official Node.js 14 LTS image as the base image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js v20 on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory
55
WORKDIR /app
66

77
# Copy package.json and package-lock.json
88
COPY package*.json ./
99

10-
# Install dependencies
10+
# Install dependencies using npm ci for a clean install
1111
RUN npm ci
1212

1313
# Copy the rest of the application source code
1414
COPY . .
1515

1616
# Define the command to run the application
17-
CMD ["node", "index.mjs"]
17+
CMD ["node", "index.mjs"]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Use the official Node.js 14 LTS image as the base image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory
55
WORKDIR /app
66

77
# Copy package.json and package-lock.json
88
COPY package*.json ./
99

10-
# Install dependencies
10+
# Install dependencies using npm ci for a clean install
1111
RUN npm ci
1212

1313
# Copy the rest of the application source code
1414
COPY . .
1515

1616
# Define the command to run the application
17-
CMD ["node", "index.mjs"]
17+
CMD ["node", "index.mjs"]

samples/bullmq-bullboard-redis/compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
- BOARD_PASSWORD
1414
- QUEUE
1515
depends_on:
16-
- redis
16+
- redisx
1717
#deploy:
1818
# resources:
1919
# reservations:
@@ -32,7 +32,7 @@ services:
3232
- REDIS=redis://redisx:6379
3333
- QUEUE
3434
depends_on:
35-
- redis
35+
- redisx
3636
#deploy:
3737
# resources:
3838
# reservations:
@@ -51,7 +51,7 @@ services:
5151
healthcheck:
5252
test: ["CMD", "wget", "-q", "--spider", "127.0.0.1:3000"]
5353
depends_on:
54-
- redis
54+
- redisx
5555
#deploy:
5656
# resources:
5757
# reservations:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Use the official Node.js 14 LTS image as the base image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory
55
WORKDIR /app
66

77
# Copy package.json and package-lock.json
88
COPY package*.json ./
99

10-
# Install dependencies
10+
# Install dependencies using npm ci for a clean install
1111
RUN npm ci
1212

1313
# Copy the rest of the application source code
1414
COPY . .
1515

1616
# Define the command to run the application
17-
CMD ["node", "index.mjs"]
17+
CMD ["node", "index.mjs"]

samples/feathersjs/src/Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
FROM node:latest
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
23

4+
# Set the working directory
35
WORKDIR /usr/src/app
46

5-
COPY package.json ./
7+
# Copy package.json and package-lock.json if available
8+
COPY package*.json ./
69

10+
# Install dependencies
711
RUN npm install
812

9-
COPY * ./
13+
# Copy the rest of the application source code
14+
COPY . ./
1015

16+
# Expose port 3030
1117
EXPOSE 3030
1218

13-
CMD [ "node", "index.js" ]
19+
# Define the command to run the application
20+
CMD ["node", "index.js"]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM mcr.microsoft.com/devcontainers/java:11-bookworm
2+
3+
# Install Maven
4+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5+
&& apt-get -y install --no-install-recommends maven
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile",
4+
"context": ".."
5+
},
6+
"features": {
7+
"ghcr.io/defanglabs/devcontainer-feature/defang-cli:1.0.4": {},
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
9+
}
10+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout Repo
17+
uses: actions/checkout@v4
18+
19+
- name: Deploy
20+
uses: DefangLabs/[email protected]

samples/javalin/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Javalin Sample
2+
3+
[1-click deploy](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-javalin-template%26template_owner%3DDefangSamples)
4+
5+
This sample demonstrates how to deploy a very basic Javalin sample with Defang. The sample simply outputs "Defang x Javalin" on the webpage.
6+
7+
## Prerequisites
8+
9+
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
10+
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
11+
3. (Optional - for local development) [Docker CLI](https://docs.docker.com/engine/install/)
12+
13+
## Deploying
14+
15+
1. Open the terminal and type `defang login`
16+
2. Type `defang compose up` in the CLI.
17+
3. Your app will be running within a few minutes.
18+
19+
## Development
20+
21+
For development, we use a local container. This can be seen in the compose.yaml file. To run the sample locally use the following command:
22+
23+
```bash
24+
docker compose up --build
25+
```
26+
27+
---
28+
29+
Title: Javalin
30+
31+
Short Description: A short hello world application demonstrating how to deploy Javalin onto defang.
32+
33+
Tags: Javalin, Java, Maven
34+
35+
Languages: java

0 commit comments

Comments
 (0)