docker composes
This commit is contained in:
parent
71c4f5022c
commit
a90cdc08b8
9 changed files with 88 additions and 54 deletions
14
.env.sample
14
.env.sample
|
|
@ -1,7 +1,9 @@
|
||||||
APP_NAME=Yavsc
|
APP_NAME=Yavsc
|
||||||
YAVSC_CONNECTION_HOST=localhost
|
POSTGRES_HOST=localhost
|
||||||
YAVSC_CONNECTION_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
YAVSC_CONNECTION_DATABASE=Yavsc
|
POSTGRES_DB=yavsc
|
||||||
YAVSC_CONNECTION_USERNAME=Yavsc
|
POSTGRES_USER=yavsc
|
||||||
YAVSC_CONNECTION_PASSWORD=lame-YAVSC_CONNECTION_PASSWORD
|
POSTGRES_PASSWORD=lame-YAVSC_CONNECTION_PASSWORD
|
||||||
DESTDIR=/srv/www/Yavsc
|
DESTDIR=/srv/www/yavsc
|
||||||
|
|
||||||
|
ASPNETCORE_ConnectionStrings__YavscConnection=Server=$POSTGRES_HOST;Port=$POSTGRES_PORT;Database=$POSTGRES_DB;Username=$POSTGRES_USER;Password=$POSTGRES_PASSWORD;
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -53,4 +53,5 @@ binaries/
|
||||||
build/
|
build/
|
||||||
src/*/Blog-Dev/
|
src/*/Blog-Dev/
|
||||||
*.mp4
|
*.mp4
|
||||||
|
src/Yavsc.Org/data/
|
||||||
|
|
||||||
|
|
|
||||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
|
@ -5,6 +5,7 @@
|
||||||
"appsettings",
|
"appsettings",
|
||||||
"asciidoctor",
|
"asciidoctor",
|
||||||
"Cratie",
|
"Cratie",
|
||||||
|
"DESTDIR",
|
||||||
"Newtonsoft",
|
"Newtonsoft",
|
||||||
"Npgsql",
|
"Npgsql",
|
||||||
"Yavsc"
|
"Yavsc"
|
||||||
|
|
|
||||||
54
Dockerfile
54
Dockerfile
|
|
@ -1,32 +1,30 @@
|
||||||
# syntax=docker/dockerfile:1
|
# Build stage
|
||||||
# Learn about building .NET container images:
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
|
||||||
WORKDIR /app
|
|
||||||
EXPOSE 80
|
|
||||||
EXPOSE 443
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["/src", "/src"]
|
COPY . .
|
||||||
COPY "Directory.Packages.props" "Directory.Packages.props"
|
RUN dotnet publish src/Yavsc/Yavsc.csproj -c Release -o /app/publish
|
||||||
|
|
||||||
RUN dotnet nuget add source https://isn.pschneider.fr/v3/index.json --allow-insecure-connections
|
# Runtime stage
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
||||||
# Just to see if two lines above work
|
|
||||||
RUN dotnet nuget list source
|
|
||||||
|
|
||||||
RUN dotnet restore "/src/Yavsc/Yavsc.csproj"
|
|
||||||
|
|
||||||
# Copy source code and publish app
|
|
||||||
|
|
||||||
WORKDIR "/src/Yavsc"
|
|
||||||
RUN dotnet build "Yavsc.csproj" -c Release -o /app/build
|
|
||||||
|
|
||||||
FROM build AS publish
|
|
||||||
RUN dotnet publish "Yavsc.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
||||||
|
|
||||||
FROM base AS final
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
|
||||||
|
# Variables d'environnement avec valeurs par défaut
|
||||||
|
ARG POSTGRES_HOST=localhost
|
||||||
|
ARG POSTGRES_PORT=5432
|
||||||
|
ARG POSTGRES_DB=yavsc
|
||||||
|
ARG POSTGRES_USER=yavsc
|
||||||
|
ARG POSTGRES_PASSWORD
|
||||||
|
|
||||||
|
ENV POSTGRES_HOST=${POSTGRES_HOST}
|
||||||
|
ENV POSTGRES_PORT=${POSTGRES_PORT}
|
||||||
|
ENV POSTGRES_DB=${POSTGRES_DB}
|
||||||
|
ENV POSTGRES_USER=${POSTGRES_USER}
|
||||||
|
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
|
|
||||||
|
# Chaîne de connexion construite depuis les variables
|
||||||
|
ENV ConnectionStrings__DefaultConnection=\
|
||||||
|
"Host=${POSTGRES_HOST};Port=${POSTGRES_PORT};Database=${POSTGRES_DB};Username=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
|
||||||
|
|
||||||
|
COPY --from=build /app/publish .
|
||||||
|
EXPOSE 5000
|
||||||
ENTRYPOINT ["dotnet", "Yavsc.dll"]
|
ENTRYPOINT ["dotnet", "Yavsc.dll"]
|
||||||
|
|
|
||||||
7
Makefile
7
Makefile
|
|
@ -40,4 +40,11 @@ install: $(DESTDIR)
|
||||||
docker-image:
|
docker-image:
|
||||||
docker build .
|
docker build .
|
||||||
|
|
||||||
|
docker-build:
|
||||||
|
docker compose up --build
|
||||||
|
|
||||||
|
docker-run:
|
||||||
|
docker run -d -p 5000:5000 --name yavsc yavsc
|
||||||
|
|
||||||
|
|
||||||
.PHONY:
|
.PHONY:
|
||||||
|
|
|
||||||
24
docker-compose.yaml
Normal file
24
docker-compose.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:16
|
||||||
|
env_file: .env
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
POSTGRES_HOST: db
|
||||||
|
POSTGRES_PORT: ${POSTGRES_PORT}
|
||||||
|
POSTGRES_DB: ${POSTGRES_DB}
|
||||||
|
POSTGRES_USER: ${POSTGRES_USER}
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
|
env_file: .env
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net10.0-android</TargetFramework>
|
<TargetFramework>net10.0-android</TargetFramework>
|
||||||
<SupportedOSPlatformVersion>23</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>23.0.0</SupportedOSPlatformVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationId>com.CompanyName.PostIt</ApplicationId>
|
<ApplicationId>com.CompanyName.PostIt</ApplicationId>
|
||||||
<ApplicationVersion>1</ApplicationVersion>
|
<ApplicationVersion>1</ApplicationVersion>
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,28 @@
|
||||||
<UserControl xmlns="https://github.com/avaloniaui"
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:vm="using:PostIt.ViewModels"
|
xmlns:vm="using:PostIt.ViewModels"
|
||||||
xmlns:views="using:PostIt.Views"
|
xmlns:views="using:PostIt.Views"
|
||||||
xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
|
xmlns:AvaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="PostIt.Views.MainView"
|
x:Class="PostIt.Views.MainView"
|
||||||
x:DataType="vm:MainViewModel">
|
x:DataType="vm:MainViewModel">
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||||
<vm:MainViewModel />
|
<vm:MainViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
|
<StackPanel>
|
||||||
|
|
||||||
|
<Label>Hello</Label>
|
||||||
<AvaloniaEdit:TextEditor
|
<AvaloniaEdit:TextEditor
|
||||||
ShowLineNumbers="True"
|
ShowLineNumbers="True"
|
||||||
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"
|
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"
|
||||||
Background="AliceBlue"
|
Background="AliceBlue"
|
||||||
Foreground="Black"
|
Foreground="Black"
|
||||||
Watermark="Hit me strong!"
|
Watermark="Hit me strong!"
|
||||||
/>
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ namespace Yavsc
|
||||||
public const string FrontOfficeGroupName = "FrontOffice";
|
public const string FrontOfficeGroupName = "FrontOffice";
|
||||||
public const string DefaultAvatar = "/images/Users/icon_user.png";
|
public const string DefaultAvatar = "/images/Users/icon_user.png";
|
||||||
public const string AnonAvatar = "/images/Users/icon_anon_user.png";
|
public const string AnonAvatar = "/images/Users/icon_anon_user.png";
|
||||||
public const string YavscConnectionStringEnvName = "YAVSC_CONNECTION_STRING";
|
|
||||||
public const string YavscConnectionStringName = "YavscConnection";
|
public const string YavscConnectionStringName = "YavscConnection";
|
||||||
|
|
||||||
// at the end, let 4*4 bytes in peace
|
// at the end, let 4*4 bytes in peace
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue