forked from authgear/authgear-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (53 loc) · 1.74 KB
/
Dockerfile
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
# Stage 1: Build the Go binary
FROM golang:1.17.7-bullseye as stage1
# Install build time C dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libicu-dev \
libvips-dev \
libmagic-dev \
&& rm -rf /var/lib/apt/lists/*
ARG GIT_HASH
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make build BIN_NAME=authgear TARGET=authgear GIT_HASH=$GIT_HASH
# We used to build static binary.
# But we have a transitive dependency on icu4c so this is no longer the case.
# RUN readelf -d ./authgear | grep 'There is no dynamic section in this file'
# Stage 2: Build the static files
FROM node:16.14.0-bullseye as stage2
ARG GIT_HASH
WORKDIR /usr/src/app
COPY ./scripts/npm/package.json ./scripts/npm/package-lock.json ./scripts/npm/
RUN cd ./scripts/npm && npm ci
COPY ./authui/package.json ./authui/package-lock.json ./authui/
RUN cd ./authui && npm ci
COPY . .
RUN make authui GIT_HASH=$GIT_HASH
# Stage 3: Prepare the actual fs we use to run the program
FROM debian:bullseye-20220125-slim
ARG GIT_HASH
WORKDIR /app
# /etc/mime.types (mime-support)
# /usr/share/ca-certificates/*/* (ca-certificates)
# /usr/share/zoneinfo/ (tzdata)
RUN apt-get update && apt-get install -y --no-install-recommends \
libicu-dev \
libvips-dev \
libmagic-dev \
libmagic-mgc \
ca-certificates \
mime-support \
tzdata \
&& rm -rf /var/lib/apt/lists/*
RUN update-ca-certificates
COPY ./GeoLite2-Country.mmdb ./GeoLite2-Country.mmdb
COPY ./migrations ./migrations
COPY --from=stage1 /src/authgear /usr/local/bin/
COPY ./resources/authgear/ ./resources/authgear/
COPY --from=stage2 /usr/src/app/resources/authgear/static/ ./resources/authgear/static/
USER nobody
EXPOSE 3000
CMD ["authgear", "start"]