diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..f7edf91 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,48 @@ +kind: pipeline +type: docker +name: deploy + +steps: +# GO api + - name: build_api + image: golang + environment: + - GIN_MODE=release + commands: + - cd Api + - go build +# Platformio esp firmware +# - name: build_esp +# C# frontend +# upload docker + - name: upload_frontend + when: + branch: + - master + settings: + dockerfile: ManagementPage/ManagementPage/Dockerfile + repo: "registry.jacknet.io/51m0n/environment-api" + username: simon + password: + from_secret: docker_password + registry: registry.jacknet.io + auto_tag: true +# upload docker + - name: upload_api + depends_on: + - build_api + image: plugins/docker + when: + branch: + - master + settings: + context: Api + dockerfile: Api/Dockerfile + repo: "registry.jacknet.io/51m0n/environment-api" + username: simon + password: + from_secret: docker_password + registry: registry.jacknet.io + auto_tag: true +# upload firmware blob +# - name: upload_esp \ No newline at end of file diff --git a/Api/Dockerfile b/Api/Dockerfile new file mode 100644 index 0000000..5914d74 --- /dev/null +++ b/Api/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu + +EXPOSE 8080 + +ENV GIN_MODE=release + +COPY EnvironmentManagerAPI /EnvironmentManagerAPI + +ENTRYPOINT ["./EnvironmentManagerAPI"] \ No newline at end of file diff --git a/ManagementPage/.dockerignore b/ManagementPage/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/ManagementPage/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/ManagementPage/ManagementPage/Dockerfile b/ManagementPage/ManagementPage/Dockerfile new file mode 100644 index 0000000..92f7b66 --- /dev/null +++ b/ManagementPage/ManagementPage/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["ManagementPage/ManagementPage.csproj", "ManagementPage/"] +RUN dotnet restore "ManagementPage/ManagementPage.csproj" +COPY . . +WORKDIR "/src/ManagementPage" +RUN dotnet build "ManagementPage.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "ManagementPage.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "ManagementPage.dll"] \ No newline at end of file diff --git a/ManagementPage/ManagementPage/ManagementPage.csproj b/ManagementPage/ManagementPage/ManagementPage.csproj index d6e0563..f23054f 100644 --- a/ManagementPage/ManagementPage/ManagementPage.csproj +++ b/ManagementPage/ManagementPage/ManagementPage.csproj @@ -4,10 +4,13 @@ net6.0 enable enable + a667e9e0-64d9-4a5e-a721-f9c32f29af02 + Linux + diff --git a/ManagementPage/ManagementPage/ManagementPage.csproj.user b/ManagementPage/ManagementPage/ManagementPage.csproj.user index 3052f3a..373ca0d 100644 --- a/ManagementPage/ManagementPage/ManagementPage.csproj.user +++ b/ManagementPage/ManagementPage/ManagementPage.csproj.user @@ -5,5 +5,7 @@ root/Common/MVC/Controller RazorPageScaffolder root/Common/RazorPage + P:\EnvironmentManagement\ManagementPage\ManagementPage\Properties\PublishProfiles\registry.jacknet.io.pubxml + Docker \ No newline at end of file diff --git a/ManagementPage/ManagementPage/Properties/launchSettings.json b/ManagementPage/ManagementPage/Properties/launchSettings.json index b2cdac3..9f5b2a5 100644 --- a/ManagementPage/ManagementPage/Properties/launchSettings.json +++ b/ManagementPage/ManagementPage/Properties/launchSettings.json @@ -1,4 +1,4 @@ -{ +{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, @@ -10,12 +10,12 @@ "profiles": { "ManagementPage": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://environment.51m0n.com;http://+:80", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "https://environment.51m0n.com;http://+:80", + "dotnetRunMessages": true }, "IIS Express": { "commandName": "IISExpress", @@ -23,6 +23,13 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "publishAllPorts": true, + "useSSL": true } } -} +} \ No newline at end of file