-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (34 loc) · 1.48 KB
/
Dockerfile
File metadata and controls
48 lines (34 loc) · 1.48 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
FROM ubuntu:22.04 AS base
# use root to be able to use privilidged port 80
# https://github.com/dotnet/aspnetcore/discussions/53015
USER root
WORKDIR /app
EXPOSE 80
# pip is installed here because it needs to be available in both the build and final stages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends pip
FROM base AS build
WORKDIR /src
COPY . .
RUN apt-get -y install --no-install-recommends \
build-essential clang lld make cmake ninja-build gdb \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN pip install conan
# this is necessary so that Conan can see the local dependency recipes
RUN conan remote add local-recipes ./deps --type=local-recipes-index
RUN conan build . --build=missing \
--profile:all=.devcontainer/to-dos-conan-profile.conf \
# This is necessary because, by default, the `build_type` property in the profile is set to `Debug`
--settings:host="build_type=Release"
FROM base AS final
# alembic, psycopg2-binary and sqlalchemy-utils are used for performing migrations
RUN pip install alembic psycopg2-binary sqlalchemy-utils
WORKDIR /app
# alembic needs this to apply the migrations correctly
COPY --from=build /src/src/data/alembic.ini ./alembic/
COPY --from=build /src/src/data/migrations/ ./alembic/migrations/
COPY --from=build /src/src/data/models/ ./alembic/models/
COPY --from=build /src/build/Release/to-dos-api .
ENTRYPOINT ["./to-dos-api"]