-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile_WebImageOptimApi
More file actions
61 lines (47 loc) · 1.92 KB
/
Dockerfile_WebImageOptimApi
File metadata and controls
61 lines (47 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Get build image
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /app
# Copy source
COPY . ./
# Restore packages
RUN dotnet restore
# Publish
RUN dotnet publish -c Release -o "/app/publish/WebImageOptimApi" "WebImageOptimApi"
# Get runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as publish
WORKDIR /app
# Install curl for health monitoring
RUN apt-get update && \
apt-get install --no-install-recommends -y curl=7.74.0-1.3+deb11u3 && \
rm -rf /var/lib/apt/lists/*
# Bring in metadata via --build-arg
ARG BRANCH=unknown
ARG IMAGE_CREATED=unknown
ARG IMAGE_REVISION=unknown
ARG IMAGE_VERSION=unknown
# Configure image labels
LABEL branch=$branch \
maintainer="Maricopa County Library District developers <development@mcldaz.org>" \
org.opencontainers.image.authors="Maricopa County Library District developers <development@mcldaz.org>" \
org.opencontainers.image.created=$IMAGE_CREATED \
org.opencontainers.image.description="Console project to exercise the ImageOptimApi NuGet package" \
org.opencontainers.image.documentation="https://github.com/MCLD/SampleImageOptimApi" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.revision=$IMAGE_REVISION \
org.opencontainers.image.source="https://github.com/MCLD/SampleImageOptimApi" \
org.opencontainers.image.title="WebImageOptimApi" \
org.opencontainers.image.url="https://github.com/MCLD/SampleImageOptimApi" \
org.opencontainers.image.vendor="Maricopa County Library District" \
org.opencontainers.image.version=$IMAGE_VERSION
# Default image environment variable settings
ENV org.opencontainers.image.created=$IMAGE_CREATED \
org.opencontainers.image.revision=$IMAGE_REVISION \
org.opencontainers.image.version=$IMAGE_VERSION
# Copy source
COPY --from=build "/app/publish/WebImageOptimApi" .
# Port 80 for http
EXPOSE 80
# Configure health check
HEALTHCHECK CMD curl --fail http://localhost/health/ || exit
# Set entrypoint
ENTRYPOINT ["dotnet", "WebImageOptimApi.dll"]