-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile_ops
68 lines (52 loc) · 2.07 KB
/
Dockerfile_ops
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
62
63
64
65
66
67
68
# Get build image
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
# Copy source
COPY . ./
# Restore packages
RUN dotnet restore
# Build project and run tests
RUN dotnet test -v m /property:WarningLevel=0
# Publish
WORKDIR /app/src/Ops.Web
RUN dotnet publish -v m /property:WarningLevel=0 -c Release --property:PublishDir=/app/publish/ops
# Get runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0 as publish
WORKDIR /app
# Install curl for health monitoring
RUN apt-get update \
&& apt-get install --no-install-recommends -y curl=7.88.1-10+deb12u7 \
&& 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="Ocuda Ops content management for libraries" \
org.opencontainers.image.documentation="https://github.com/MCLD/ocuda" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.revision=$IMAGE_REVISION \
org.opencontainers.image.source="https://github.com/MCLD/ocuda" \
org.opencontainers.image.title="Ocuda Ops" \
org.opencontainers.image.url="https://github.com/MCLD/ocuda" \
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/ops" .
# Persist shared directory
VOLUME ["/app/shared"]
# Port 80 for http
EXPOSE 80
# Configure health check
HEALTHCHECK CMD curl --fail http://localhost:8080/healthcheck || exit
# Set entrypoint
ENTRYPOINT ["dotnet", "Ocuda.Ops.Web.dll"]