Relocate Dockerfiles

This commit is contained in:
Adit Sachde 2019-10-04 12:18:58 -04:00
parent 9a56cf8439
commit 3b47a7a749
31 changed files with 147 additions and 1 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2017 Vector Creations Ltd
fBIN// Copyright 2017 Vector Creations Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.

View file

@ -0,0 +1,14 @@
FROM golang:1.12.9
WORKDIR /app
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
# Statically link binaries
ENV CGO_ENABLED=0
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Build the Go app
RUN ./build.sh

View file

@ -0,0 +1,13 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/client-api-proxy /
# Component specific entrypoint, environment variables, and arguments
CMD /client-api-proxy \
-bind-address $CLIENT_BIND_ADDRESS \
-client-api-server-url $CLIENT_API_SERVER_URL \
-sync-api-server-url $SYNC_API_SERVER_URL \
-media-api-server-url $MEDIA_API_SERVER_URL \
-public-rooms-api-server-url $PUBLIC_ROOMS_API_SERVER_URL

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-appservice-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-appservice-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-client-api-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-client-api-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-federation-api-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-federation-api-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-federation-sender-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-federation-sender-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-media-api-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-media-api-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-public-rooms-api-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-public-rooms-api-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-room-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-room-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-sync-api-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-sync-api-server \
--config $CONFIG

View file

@ -0,0 +1,9 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/dendrite-typing-server /
# Component specific entrypoint, environment variables, and arguments
CMD /dendrite-typing-server \
--config $CONFIG

View file

@ -0,0 +1,13 @@
FROM dendrite:latest as build-env
# Copy the binary from build container to final container
FROM alpine:3.10
COPY --from=build-env /app/bin/federation-api-proxy /
# Component specific entrypoint, environment variables, and arguments
CMD /federation-api-proxy \
-bind-address $FEDERATION_BIND_ADDRESS \
-media-api-server-url $MEDIA_API_SERVER_URL \
-federation-api-url $FEDERATION_API_URL \
-tls-cert $FEDERATION_TLS_CERT \
-tls-key $FEDERATION_TLS_KEY

View file

@ -0,0 +1,25 @@
# Docker Images
## Build
The main `Dockerfile` builds installs all go modules and builds all the go binaries in `golang:1.12.9`, and should be tagged `dendrite:latest`. This tag is ensures that it cannot be pushed, and a CI/CD server should not have it cached.
All the other containers are generated from the binaries built in the first container. It copies the binary from `dendrite:latest` to the root of `alpine:3.10`.
## Usage
## Environment Variables
```yaml
# bind-address arg to client-api-proxy
client-bind-address
# bind-address arg to federation-api-proxy
federation-bind-address
client-api-server-url
sync-api-server-url
media-api-server-url
public-rooms-api-server-url
federation-api-url
config
```