Skip to content

Commit

Permalink
update docker
Browse files Browse the repository at this point in the history
  • Loading branch information
EdiWang committed Nov 15, 2023
1 parent e34f145 commit 14a2019
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
id: docker_build
uses: docker/build-push-action@v3
with:
context: ./src/API
file: ./src/API/Dockerfile
context: ./src
file: ./src/Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/elf:latest

Expand Down
File renamed without changes.
27 changes: 0 additions & 27 deletions src/API/Dockerfile

This file was deleted.

24 changes: 24 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
LABEL maintainer="edi.wang@outlook.com"
LABEL repo="https://github.com/EdiWang/Elf"

USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["API/Elf.Api.csproj", "Elf.Api/"]
RUN dotnet restore "API/Elf.Api.csproj"
COPY . .
WORKDIR "/src/Elf.Api"
RUN dotnet build "Elf.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Elf.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app

0 comments on commit 14a2019

Please sign in to comment.