-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove packages from registry Docker build (#583)
The Dockerfile for the registry itself should not contain any packages. Instead it should be empty and there are other distributions with packages, see elastic/package-storage#86. This removes the packages from the default Docker build. Few additional changes in the this PR:
- Loading branch information
Showing
7 changed files
with
44 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ package-registry | |
|
||
.idea | ||
build | ||
public/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,37 @@ | ||
# This Dockerfile allows to build the package-registry and packages together. | ||
# It is decoupled from the packages and the registry even though for now both are in the same repository. | ||
# This image contains the package-registry binary. | ||
# It expects packages to be mounted under /packages/package-registry or have a config file loaded into /package-registry/config.yml | ||
|
||
# Build binary | ||
ARG GO_VERSION=1.14.2 | ||
FROM golang:${GO_VERSION} | ||
FROM golang:${GO_VERSION} AS builder | ||
|
||
# Get dependencies | ||
RUN \ | ||
apt-get update \ | ||
&& apt-get install -y --no-install-recommends zip rsync \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ENV GO111MODULE=on | ||
COPY ./ /package-registry | ||
WORKDIR /package-registry | ||
RUN go build . | ||
|
||
# Copy the package registry | ||
COPY ./ /home/package-registry | ||
WORKDIR /home/package-registry | ||
|
||
ENV GO111MODULE=on | ||
RUN go get -u github.com/magefile/mage | ||
# Prepare all the packages to be built | ||
RUN mage build | ||
# Run binary | ||
FROM centos:7 | ||
|
||
# Build binary | ||
RUN go build . | ||
# Get dependencies | ||
RUN yum install -y zip rsync && yum clean all | ||
|
||
# Move all files need to run to its own directory | ||
# This will become useful for staged builds later on | ||
RUN mkdir -p /registry/public # left for legacy purposes | ||
RUN mkdir -p /registry/packages/package-storage | ||
RUN mv package-registry /registry/ | ||
RUN cp -r build/package-storage/packages/* /registry/packages/package-storage/ | ||
RUN cp config.docker.yml /registry/config.yml | ||
# Move binary from the builder image | ||
COPY --from=builder /package-registry/package-registry /package-registry/package-registry | ||
|
||
# Change to new working directory | ||
WORKDIR /registry | ||
WORKDIR /package-registry | ||
|
||
# Clean up files not needed | ||
RUN rm -rf /home/package-registry | ||
# Get in config which expects packages in /packages | ||
COPY config.docker.yml /package-registry/config.yml | ||
|
||
# Start registry when container is run an expose it on port 8080 | ||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["./package-registry"] | ||
|
||
# Make sure it's accessible from outside the container | ||
CMD ["--address=0.0.0.0:8080"] | ||
|
||
HEALTHCHECK --interval=1s --retries=30 CMD curl --silent --fail localhost:8080/health || exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package_paths: | ||
- /packages/package-storage | ||
|
||
cache_time.search: 10s | ||
cache_time.categories: 10s | ||
cache_time.catch_all: 10s |