-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'DOCKERIZED-FINAL-fullstack-app' into FINAL-fullstack-app
- Loading branch information
Showing
19 changed files
with
751 additions
and
49 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,32 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.DS_Store | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
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 @@ | ||
TarnishedPluto2023! |
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,139 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
################################################################################# | ||
# | ||
## Create a stage for building the application. | ||
#FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build | ||
# | ||
#COPY . /source | ||
# | ||
#WORKDIR /source/TripPlannerAPI | ||
# | ||
## This is the architecture you’re building for, which is passed in by the builder. | ||
## Placing it here allows the previous steps to be cached across architectures. | ||
#ARG TARGETARCH | ||
# | ||
## Build the application. | ||
## Leverage a cache mount to /root/.nuget/packages so that subsequent builds don't have to re-download packages. | ||
## If TARGETARCH is "amd64", replace it with "x64" - "x64" is .NET's canonical name for this and "amd64" doesn't | ||
## work in .NET 6.0. | ||
#RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \ | ||
#dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app | ||
# | ||
################################################################################# | ||
## Create a new stage for running EF Core migrations. | ||
#FROM build AS migrate | ||
# | ||
## Install the dotnet-ef tool | ||
#RUN dotnet tool install --global dotnet-ef --version 6.0.27 | ||
# | ||
## Restore the solution | ||
#RUN dotnet restore | ||
# | ||
## Add migrations | ||
##RUN dotnet ef migrations add initial | ||
#RUN /root/.dotnet/tools/dotnet-ef migrations add mig | ||
# | ||
## Run EF Core migrations | ||
##RUN dotnet ef database update | ||
#RUN /root/.dotnet/tools/dotnet-ef database update | ||
# | ||
################################################################################# | ||
## Create a new stage for running the application that contains the minimal | ||
## runtime dependencies for the application. This often uses a different base | ||
## image from the build stage where the necessary files are copied from the build | ||
## stage. | ||
#FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS final | ||
#WORKDIR /app | ||
# | ||
## Copy everything needed to run the app from the "build" stage. | ||
#COPY --from=build /app . | ||
# | ||
## Copy the migrated database from the "migrate" stage. | ||
#COPY --from=migrate /source/TripPlannerAPI . | ||
# | ||
## Create a non-privileged user that the app will run under. | ||
## See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
#ARG UID=10001 | ||
#RUN adduser \ | ||
#--disabled-password \ | ||
#--gecos "" \ | ||
#--home "/nonexistent" \ | ||
#--shell "/sbin/nologin" \ | ||
#--no-create-home \ | ||
#--uid "${UID}" \ | ||
#appuser | ||
#USER appuser | ||
# | ||
#ENTRYPOINT ["dotnet", "TripPlannerAPI.dll"] | ||
|
||
|
||
### OLD STUFF: | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/go/dockerfile-reference/ | ||
|
||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 | ||
|
||
################################################################################ | ||
|
||
# Learn about building .NET container images: | ||
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md | ||
|
||
# Create a stage for building the application. | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build | ||
|
||
COPY . /source | ||
|
||
WORKDIR /source/TripPlannerAPI | ||
|
||
# This is the architecture you’re building for, which is passed in by the builder. | ||
# Placing it here allows the previous steps to be cached across architectures. | ||
ARG TARGETARCH | ||
|
||
# Build the application. | ||
# Leverage a cache mount to /root/.nuget/packages so that subsequent builds don't have to re-download packages. | ||
# If TARGETARCH is "amd64", replace it with "x64" - "x64" is .NET's canonical name for this and "amd64" doesn't | ||
# work in .NET 6.0. | ||
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \ | ||
dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app | ||
|
||
# If you need to enable globalization and time zones: | ||
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md | ||
################################################################################ | ||
# Create a new stage for running the application that contains the minimal | ||
# runtime dependencies for the application. This often uses a different base | ||
# image from the build stage where the necessary files are copied from the build | ||
# stage. | ||
# | ||
# The example below uses an aspnet alpine image as the foundation for running the app. | ||
# It will also use whatever happens to be the most recent version of that tag when you | ||
# build your Dockerfile. If reproducability is important, consider using a more specific | ||
# version (e.g., aspnet:7.0.10-alpine-3.18), | ||
# or SHA (e.g., mcr.microsoft.com/dotnet/aspnet@sha256:f3d99f54d504a21d38e4cc2f13ff47d67235efeeb85c109d3d1ff1808b38d034). | ||
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS final | ||
WORKDIR /app | ||
|
||
RUN apk add --no-cache icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib | ||
|
||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false | ||
|
||
# Copy everything needed to run the app from the "build" stage. | ||
COPY --from=build /app . | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
appuser | ||
USER appuser | ||
|
||
ENTRYPOINT ["dotnet", "TripPlannerAPI.dll"] |
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,24 @@ | ||
### Building and running your application | ||
|
||
When you're ready, start your application by running: | ||
`docker compose up --build`. | ||
|
||
Your application will be available at http://localhost:8080. | ||
|
||
### Deploying your application to the cloud | ||
|
||
First, build your image, e.g.: `docker build -t myapp .`. | ||
If your cloud uses a different CPU architecture than your development | ||
machine (e.g., you are on a Mac M1 and your cloud provider is amd64), | ||
you'll want to build the image for that platform, e.g.: | ||
`docker build --platform=linux/amd64 -t myapp .`. | ||
|
||
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. | ||
|
||
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) | ||
docs for more detail on building and pushing. | ||
|
||
### References | ||
* [Docker's .NET guide](https://docs.docker.com/language/dotnet/) | ||
* The [dotnet-docker](https://github.com/dotnet/dotnet-docker/tree/main/samples) | ||
repository has many relevant samples and docs. |
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
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
Oops, something went wrong.