Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#2364) Rework Linux Dockerfile #2365

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions docker/Dockerfile.linux
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"
TheCakeIsNaOH marked this conversation as resolved.
Show resolved Hide resolved
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
4 changes: 4 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ To build this image yourself, follow these steps:
1. Clone down the repository using `git clone https://github.com/chocolatey/choco.git`.
1. Change directories to the root of the repository.
1. Run the docker build command. `docker build -t mono-choco -f docker/Dockerfile.linux .` (the trailing . is important)
gep13 marked this conversation as resolved.
Show resolved Hide resolved
To build a official version, add the argument `--build-arg buildscript=build.official.sh`
To build a debug version, add the argument `--build-arg buildscript=build.official.sh`
To change the version of mono used, add the argument `--build-arg monoversion=mono-tag`
1. Run your new image using the command `docker run -ti --rm mono-choco /bin/bash`
1. Test choco by running `choco -h`. You should see the help message from choco.exe.

3 changes: 3 additions & 0 deletions docker/choco_official_wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

mono /opt/chocolatey/choco.exe "$@"
2 changes: 1 addition & 1 deletion docker/choco_wrapper
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