Minor modifications to compose file and update Dockerfile comments
This commit is contained in:
parent
0338053774
commit
5f3cb3f926
2 changed files with 23 additions and 15 deletions
25
Dockerfile
25
Dockerfile
|
@ -7,9 +7,11 @@
|
||||||
# Alpine build image to build Conduits statically compiled binary
|
# Alpine build image to build Conduits statically compiled binary
|
||||||
FROM alpine:3.12 as builder
|
FROM alpine:3.12 as builder
|
||||||
|
|
||||||
# Specifies if the local project is build or if the git master branch
|
# Specifies if the local project is build or if Conduit gets build
|
||||||
# is build.
|
# from the official git repository. Defaults to the git repo.
|
||||||
ARG LOCAL=false
|
ARG LOCAL=false
|
||||||
|
# Specifies which revision/commit is build. Defaults to HEAD
|
||||||
|
ARG GIT_REF=HEAD
|
||||||
|
|
||||||
# Add 'edge'-repository to get Rust 1.45
|
# Add 'edge'-repository to get Rust 1.45
|
||||||
RUN sed -i \
|
RUN sed -i \
|
||||||
|
@ -24,11 +26,11 @@ RUN apk add --no-cache \
|
||||||
|
|
||||||
# Copy project files from current folder
|
# Copy project files from current folder
|
||||||
COPY . .
|
COPY . .
|
||||||
# Build it from local files or from official git repository
|
# Build it from the copied local files or from the official git repository
|
||||||
RUN if [[ $LOCAL == "true" ]]; then \
|
RUN if [[ $LOCAL == "true" ]]; then \
|
||||||
cargo install --path . ; \
|
cargo install --path . ; \
|
||||||
else \
|
else \
|
||||||
cargo install --git "https://git.koesters.xyz/timo/conduit.git" ; \
|
cargo install --git "https://git.koesters.xyz/timo/conduit.git" --rev ${GIT_REF}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
########################## RUNTIME IMAGE ##########################
|
########################## RUNTIME IMAGE ##########################
|
||||||
|
@ -43,7 +45,7 @@ ARG GIT_REF=HEAD
|
||||||
# Labels according to https://github.com/opencontainers/image-spec/blob/master/annotations.md
|
# Labels according to https://github.com/opencontainers/image-spec/blob/master/annotations.md
|
||||||
# including a custom label specifying the build command
|
# including a custom label specifying the build command
|
||||||
LABEL org.opencontainers.image.created=${CREATED} \
|
LABEL org.opencontainers.image.created=${CREATED} \
|
||||||
org.opencontainers.image.authors="Conduit Contributors, weasy@hotmail.de" \
|
org.opencontainers.image.authors="Conduit Contributors" \
|
||||||
org.opencontainers.image.title="Conduit" \
|
org.opencontainers.image.title="Conduit" \
|
||||||
org.opencontainers.image.version=${VERSION} \
|
org.opencontainers.image.version=${VERSION} \
|
||||||
org.opencontainers.image.vendor="Conduit Contributors" \
|
org.opencontainers.image.vendor="Conduit Contributors" \
|
||||||
|
@ -54,17 +56,16 @@ LABEL org.opencontainers.image.created=${CREATED} \
|
||||||
org.opencontainers.image.documentation.="" \
|
org.opencontainers.image.documentation.="" \
|
||||||
org.opencontainers.image.licenses="AGPL-3.0" \
|
org.opencontainers.image.licenses="AGPL-3.0" \
|
||||||
org.opencontainers.image.ref.name="" \
|
org.opencontainers.image.ref.name="" \
|
||||||
org.label-schema.docker.build="docker build . -t conduit:latest --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)"\
|
org.label-schema.docker.build="docker build . -t conduit_homeserver:latest --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)" \
|
||||||
maintainer="weasy@hotmail.de"
|
maintainer="Weasy666"
|
||||||
|
|
||||||
|
# Standard port on which Rocket launches
|
||||||
EXPOSE 14004
|
EXPOSE 8000
|
||||||
|
|
||||||
# Copy config files from context and the binary from
|
# Copy config files from context and the binary from
|
||||||
# the "builder" stage to the current stage into folder
|
# the "builder" stage to the current stage into folder
|
||||||
# /srv/conduit and create data folder for database
|
# /srv/conduit and create data folder for database
|
||||||
RUN mkdir -p /srv/conduit/.local/share/conduit
|
RUN mkdir -p /srv/conduit/.local/share/conduit
|
||||||
|
|
||||||
COPY --from=builder /root/.cargo/bin/conduit /srv/conduit/
|
COPY --from=builder /root/.cargo/bin/conduit /srv/conduit/
|
||||||
|
|
||||||
# Add www-data user and group with UID 82, as used by alpine
|
# Add www-data user and group with UID 82, as used by alpine
|
||||||
|
@ -77,13 +78,17 @@ RUN set -x ; \
|
||||||
# Change ownership of Conduit files to www-data user and group
|
# Change ownership of Conduit files to www-data user and group
|
||||||
RUN chown -cR www-data:www-data /srv/conduit
|
RUN chown -cR www-data:www-data /srv/conduit
|
||||||
|
|
||||||
|
# Install packages needed to run Conduit
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
libgcc
|
libgcc
|
||||||
|
|
||||||
|
# Create a volume for the database, to persist its contents
|
||||||
VOLUME ["/srv/conduit/.local/share/conduit"]
|
VOLUME ["/srv/conduit/.local/share/conduit"]
|
||||||
|
|
||||||
# Set user to www-data
|
# Set user to www-data
|
||||||
USER www-data
|
USER www-data
|
||||||
|
# Set container home directory
|
||||||
WORKDIR /srv/conduit
|
WORKDIR /srv/conduit
|
||||||
|
# Run Conduit
|
||||||
ENTRYPOINT [ "/srv/conduit/conduit" ]
|
ENTRYPOINT [ "/srv/conduit/conduit" ]
|
||||||
|
|
|
@ -2,17 +2,20 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
conduit:
|
homeserver:
|
||||||
image: conduit_homeserver
|
image: conduit_homeserver
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- 14004:14004
|
- 14004:8000
|
||||||
volumes:
|
volumes:
|
||||||
- db:/srv/conduit/.local/share/conduit
|
- db:/srv/conduit/.local/share/conduit
|
||||||
|
### Uncomment if you want to use Rocket.toml to configure Conduit
|
||||||
|
### Note: Set env vars will override Rocket.toml values
|
||||||
|
# - ./Rocket.toml:/srv/conduit/Rocket.toml
|
||||||
environment:
|
environment:
|
||||||
ROCKET_SERVER_NAME: example.com # replace with your own name
|
ROCKET_SERVER_NAME: localhost:8000 # replace with your own name
|
||||||
### Uncomment and change values as needed
|
### Uncomment and change values as desired
|
||||||
# ROCKET_LOG: normal
|
# ROCKET_LOG: normal # Available levels are: off, debug, normal, critical
|
||||||
# ROCKET_PORT: 14004
|
# ROCKET_PORT: 14004
|
||||||
# ROCKET_REGISTRATION_DISABLED: 'true'
|
# ROCKET_REGISTRATION_DISABLED: 'true'
|
||||||
# ROCKET_ENCRYPTION_DISABLED: 'true'
|
# ROCKET_ENCRYPTION_DISABLED: 'true'
|
||||||
|
|
Loading…
Reference in a new issue