forked from chocolatey/choco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chocolatey#2364) Rework Linux Dockerfile
Rework the Dockerfile for Linux. Move to a multi-stage build so the source code is not brought along into the final image (chocolatey#2364). Add build args to select the build script and mono version to use. Remove deprecated MAINTAINER instruction and add metadata with LABEL (chocolatey#2361). Add "choco.exe" to path, so both "choco" and "choco.exe" can be used, like Windows supports (chocolatey#2362). Change the install location to "/opt/chocolatey" as that is more in line with the Linux filesystem hierarchy (chocolatey#2360). Create the "lib" directory to prevent the warning about the directory not being found (chocolatey#2363). The choco_official_wrapper is used for official builds, where the "--allow-unofficial" argument is not needed.
- Loading branch information
1 parent
2f554cb
commit 1833156
Showing
4 changed files
with
40 additions
and
11 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 |
---|---|---|
@@ -1,21 +1,43 @@ | ||
FROM mono:6.12 | ||
|
||
MAINTAINER Justin Phelps <linuturk@onitato.com> | ||
ARG monoversion="6.12" | ||
FROM mono:${monoversion} as build | ||
|
||
RUN apt-get update && apt-get install git -y | ||
|
||
COPY . /usr/local/src/choco/ | ||
|
||
WORKDIR /usr/local/src/choco | ||
RUN chmod +x build.sh | ||
RUN chmod +x zip.sh | ||
RUN ./build.sh | ||
RUN chmod +x *.sh | ||
|
||
ARG buildscript="build.sh" | ||
RUN ./$buildscript | ||
|
||
RUN if [ "$buildscript" = "build.official.sh" ]; then \ | ||
cp docker/choco_official_wrapper code_drop/chocolatey/console/choco_wrapper; \ | ||
else \ | ||
cp docker/choco_wrapper code_drop/chocolatey/console/choco_wrapper; \ | ||
fi; | ||
|
||
|
||
ARG monoversion="6.12" | ||
FROM mono:${monoversion} as install | ||
|
||
ARG monoversion="6.12" | ||
LABEL org.opencontainers.image.url="https://chocolatey.org/" | ||
LABEL org.opencontainers.image.documentation="https://docs.chocolatey.org/" | ||
LABEL org.opencontainers.image.source="https://github.com/chocolatey/choco" | ||
LABEL org.opencontainers.image.vendor="Chocolatey Software, Inc" | ||
LABEL org.opencontainers.image.licenses="Apache-2.0" | ||
LABEL org.opencontainers.image.title="Chocolatey" | ||
LABEL org.opencontainers.image.description="Chocolatey Client running on Mono" | ||
LABEL org.opencontainers.image.authors="https://chocolatey.org/support" | ||
LABEL org.opencontainers.image.base.name="index.docker.io/library/mono:${monoversion}" | ||
|
||
WORKDIR /usr/local/bin | ||
RUN ln -s /usr/local/src/choco/code_drop/chocolatey | ||
ENV ChocolateyInstall /opt/chocolatey | ||
|
||
COPY docker/choco_wrapper /usr/local/bin/choco | ||
COPY --from=build /usr/local/src/choco/code_drop/chocolatey/console /opt/chocolatey | ||
|
||
ENV ChocolateyInstall /usr/local/bin/chocolatey | ||
RUN mkdir /opt/chocolatey/lib; \ | ||
cp /opt/chocolatey/choco_wrapper usr/local/bin/choco; \ | ||
cp /opt/chocolatey/choco_wrapper usr/local/bin/choco.exe; | ||
|
||
WORKDIR /root |
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,3 @@ | ||
#!/bin/bash | ||
|
||
mono /opt/chocolatey/choco.exe "$@" |
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,3 +1,3 @@ | ||
#!/bin/bash | ||
|
||
mono /usr/local/bin/chocolatey/console/choco.exe "$@" --allow-unofficial | ||
mono /opt/chocolatey/choco.exe "$@" --allow-unofficial |