-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 changed files
with
124 additions
and
17 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,33 @@ | ||
# Use the official Python base image | ||
FROM python:latest | ||
|
||
# Get environment variables | ||
ARG app_port=8000 | ||
ARG author="Your name" | ||
ARG version="1.0" | ||
|
||
ENV APP_HOST=0.0.0.0 | ||
ENV APP_PORT=${app_port} | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy the requirements file to the working directory | ||
COPY requirements.txt . | ||
|
||
# Install the dependencies | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the application code to the working directory | ||
COPY . . | ||
|
||
# Expose the port on which the application will run | ||
EXPOSE ${APP_PORT} | ||
|
||
# Set the entrypoint command to run the FastAPI application | ||
CMD ["uvicorn", "main:app", "--host", "${APP_HOST}", "--port", "${APP_PORT}"] | ||
|
||
# Add labels for better maintainability | ||
LABEL maintainer=${author} | ||
LABEL version=${version} | ||
LABEL description="Dockerfile for running a FastAPI application" |
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
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
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
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
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,45 @@ | ||
# Use the official PHP image as the base image | ||
FROM php:latest | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /var/www/html | ||
|
||
# Copy the PHP application files to the container | ||
COPY . . | ||
|
||
# Install any necessary dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
zip \ | ||
unzip | ||
|
||
# Install PHP extensions | ||
RUN docker-php-ext-install pdo_mysql | ||
|
||
# Get environment variables | ||
ARG author="Your name" | ||
ARG version="1.0" | ||
|
||
ARG mysql_host=localhost | ||
ARG mysql_port=3306 | ||
ARG mysql_database=myapp | ||
ARG mysql_user=root | ||
ARG mysql_password=secret | ||
|
||
# Set environment variables for configuration | ||
ENV MYSQL_HOST=${mysql_host} \ | ||
MYSQL_PORT=${mysql_port} \ | ||
MYSQL_DATABASE=${mysql_database} \ | ||
MYSQL_USER=${mysql_user} \ | ||
MYSQL_PASSWORD=${mysql_password} | ||
|
||
# Expose port 80 for the web server | ||
EXPOSE 80 | ||
|
||
# Set a default command to run when the container starts | ||
CMD ["php", "-S", "0.0.0.0:80"] | ||
|
||
# Add labels for better maintainability | ||
LABEL maintainer=${author} | ||
LABEL version=${version} | ||
LABEL description="Dockerfile for running a FastAPI application" |
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,29 @@ | ||
# Use the official Rust image as the base image | ||
FROM rust:latest | ||
|
||
# Get environment variables for configuration | ||
ARG app_port=8080 | ||
|
||
ENV APP_PORT=${app_port} | ||
ENV APP_HOST=0.0.0.0 | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy the Cargo.toml and Cargo.lock files to the working directory | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# Build the dependencies of the Rust application | ||
RUN cargo build --release | ||
|
||
# Copy the source code to the working directory | ||
COPY src ./src | ||
|
||
# Build the Rust application | ||
RUN cargo build --release | ||
|
||
# Expose the port on which the application will listen | ||
EXPOSE $APP_PORT | ||
|
||
# Set the command to run the Rust application | ||
CMD ["cargo", "run", "--release"] |