- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
docker image のサイズ削減など #10
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
          
     Open
      
      
            earlgray283
  wants to merge
  10
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
refactor-docker
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            10 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      4307982
              
                chore: test 用のスクリプトなどを移動
              
              
                earlgray283 dce8947
              
                refactor: キャッシュの削除などを入れた
              
              
                earlgray283 45bceab
              
                fix: ignore .DS_Store
              
              
                earlgray283 21e9ed7
              
                fix: clippy
              
              
                earlgray283 3feae89
              
                refactor: 不要なファイルを削除
              
              
                earlgray283 20a69dc
              
                chore: add .hadolint
              
              
                earlgray283 7ac578e
              
                refactor: Dockerfile
              
              
                earlgray283 6126c65
              
                fix: executable file nmae
              
              
                earlgray283 0eda7a4
              
                chore: ignore .vscode/
              
              
                earlgray283 c5460b9
              
                fix: ruby のインストール
              
              
                earlgray283 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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,2 @@ | ||
| target/ | ||
| .git/ | 
  
    
      This file contains hidden or 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,5 @@ | ||
| /target | ||
| /.env | ||
| /service-account-cafecoder.json | ||
| /service-account-cafecoder.json | ||
| .DS_Store | ||
| /.vscode | 
  
    
      This file contains hidden or 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,4 @@ | ||
| ignored: | ||
| - DL3008 | ||
| - DL3003 | ||
| - DL4006 | 
  
    
      This file contains hidden or 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,163 +1,177 @@ | ||
| # Ubuntu:20.04(amd64) | ||
| # m1 mac だとハッシュを指定しないと arm64 で build してしまうので・・。 | ||
| FROM ubuntu@sha256:e3d7ff9efd8431d9ef39a144c45992df5502c995b9ba3c53ff70c5b52a848d9c | ||
| FROM rust:1.57.0 AS build | ||
|  | ||
| WORKDIR /work | ||
| COPY . /work | ||
| RUN cargo build --release | ||
|  | ||
| FROM ubuntu:20.04 | ||
|  | ||
| ENV TZ Asia/Tokyo | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|  | ||
| SHELL ["/bin/bash", "-c"] | ||
| RUN sed -i -e 's/archive.ubuntu.com/jp.archive.ubuntu.com/g' /etc/apt/sources.list | ||
|  | ||
| # install compilers | ||
| RUN \ | ||
| apt update && apt install -y \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| software-properties-common \ | ||
| apt-transport-https \ | ||
| dirmngr \ | ||
| curl \ | ||
| wget \ | ||
| time \ | ||
| iproute2 \ | ||
| build-essential \ | ||
| apt-utils \ | ||
| sudo \ | ||
| unzip \ | ||
| git | ||
| git \ | ||
| gnupg \ | ||
| libssl-dev \ | ||
| ca-certificates \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # Raku install | ||
| RUN apt-get install -y rakudo | ||
| RUN \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| rakudo \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # C#(mono) install | ||
| RUN apt install gnupg ca-certificates -y && \ | ||
| yes | apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ | ||
| echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \ | ||
| apt update && \ | ||
| apt install mono-devel -y | ||
| RUN \ | ||
| yes | apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ | ||
| && echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ | ||
| && apt-get update && apt-get install -y --no-install-recommends \ | ||
| mono-devel \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # C#(.NET) install | ||
| RUN wget https://download.visualstudio.microsoft.com/download/pr/820db713-c9a5-466e-b72a-16f2f5ed00e2/628aa2a75f6aa270e77f4a83b3742fb8/dotnet-sdk-5.0.100-linux-x64.tar.gz && \ | ||
| mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-5.0.100-linux-x64.tar.gz -C $HOME/dotnet && \ | ||
| echo 'export DOTNET_ROOT=$HOME/dotnet' >> ~/.profile && \ | ||
| echo 'export PATH=$PATH:$HOME/dotnet' >> ~/.profile | ||
| RUN \ | ||
| curl -OL https://download.visualstudio.microsoft.com/download/pr/820db713-c9a5-466e-b72a-16f2f5ed00e2/628aa2a75f6aa270e77f4a83b3742fb8/dotnet-sdk-5.0.100-linux-x64.tar.gz \ | ||
| && mkdir -p "$HOME/dotnet" \ | ||
| && tar zxf dotnet-sdk-5.0.100-linux-x64.tar.gz -C "$HOME/dotnet" \ | ||
| && rm dotnet-sdk-5.0.100-linux-x64.tar.gz | ||
| ENV DOTNET_ROOT="/root/dotnet" | ||
| ENV PATH="${PATH}:/root/dotnet" | ||
|  | ||
| # C/C++ install | ||
| RUN apt-get install g++-10 gcc-10 -y | ||
| RUN \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| g++-10 \ | ||
| gcc-10 \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # Java11 install | ||
| RUN apt install default-jdk -y | ||
| RUN \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| default-jdk \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # Python3 install | ||
| RUN apt install python3.9 -y | ||
| RUN \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| python3.9 \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # Pypy3 install | ||
| RUN cd /opt && \ | ||
| wget https://downloads.python.org/pypy/pypy3.7-v7.3.3-linux64.tar.bz2 && \ | ||
| tar xf pypy3.7-v7.3.3-linux64.tar.bz2 && \ | ||
| cd /bin && \ | ||
| ln -s /opt/pypy3.7-v7.3.3-linux64/bin/pypy3 pypy3 | ||
| RUN \ | ||
| cd /opt \ | ||
| && curl -OL https://downloads.python.org/pypy/pypy3.7-v7.3.3-linux64.tar.bz2 \ | ||
| && tar xf pypy3.7-v7.3.3-linux64.tar.bz2 \ | ||
| && cd /bin \ | ||
| && ln -s /opt/pypy3.7-v7.3.3-linux64/bin/pypy3 pypy3 \ | ||
| && cd /opt \ | ||
| && rm pypy3.7-v7.3.3-linux64.tar.bz2 | ||
|  | ||
| # go install | ||
| RUN wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz && \ | ||
| tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz && \ | ||
| echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile | ||
|  | ||
| ENV USER=$USER | ||
| RUN \ | ||
| curl -OL https://golang.org/dl/go1.15.5.linux-amd64.tar.gz \ | ||
| && tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz \ | ||
| && rm go1.15.5.linux-amd64.tar.gz | ||
| ENV PATH="${PATH}:/usr/local/go/bin" | ||
|  | ||
| # Rust install | ||
| RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \ | ||
| source $HOME/.cargo/env && \ | ||
| cargo new rust_workspace && \ | ||
| cd rust_workspace &&\ | ||
| wget https://raw.githubusercontent.com/cafecoder-dev/language-update/20.10/Rust/Cargo.toml -O Cargo.toml && \ | ||
| cargo build --release && \ | ||
| cd / | ||
| RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
| ENV PATH="${PATH}:/root/.cargo/bin" | ||
|  | ||
| RUN \ | ||
| mkdir -p /judge \ | ||
| && cd judge \ | ||
| && cargo new --bin rust_workspace && cd rust_workspace \ | ||
| && curl -OL https://raw.githubusercontent.com/cafecoder-dev/language-update/20.10/Rust/Cargo.toml \ | ||
| && cargo build --release | ||
|  | ||
| # Nim install | ||
| RUN curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y && \ | ||
| echo 'export PATH=/root/.nimble/bin:$PATH' >> ~/.profile | ||
| RUN curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y \ | ||
| ENV PATH="/root/.nimble/bin:${PATH}" | ||
|  | ||
| # Ruby install | ||
| RUN apt install make libffi-dev openssl libssl-dev zlib1g-dev -y && \ | ||
| git clone https://github.com/sstephenson/rbenv.git ~/.rbenv && \ | ||
| echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile && \ | ||
| echo 'eval "$(rbenv init -)"' >> ~/.profile && \ | ||
| bash -c exec $SHELL -l && \ | ||
| git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build && \ | ||
| export PATH="$HOME/.rbenv/bin:$PATH" && rbenv install 2.7.2 && rbenv global 2.7.2 | ||
| RUN \ | ||
| curl -OL https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.gz \ | ||
| && tar xvf ruby-2.7.2.tar.gz \ | ||
| && cd ruby-2.7.2 \ | ||
| && ./configure \ | ||
| && make \ | ||
| && make install \ | ||
| && cd / \ | ||
| && rm ruby-2.7.2.tar.gz && rm -rf ruby-2.7.2 | ||
|  | ||
| # Kotlin install | ||
| RUN apt install zip unzip -y && \ | ||
| curl -s https://get.sdkman.io | bash && \ | ||
| bash && \ | ||
| echo 'source "/root/.sdkman/bin/sdkman-init.sh"' >> ~/.profile && \ | ||
| source ~/.profile && \ | ||
| sdk install kotlin | ||
| RUN \ | ||
| curl -OL https://github.com/JetBrains/kotlin/releases/download/v1.4.10/kotlin-compiler-1.4.10.zip \ | ||
| && unzip kotlin-compiler-1.4.10.zip -d /root \ | ||
| && rm kotlin-compiler-1.4.10.zip | ||
| ENV PATH="/root/kotlinc/bin:${PATH}" | ||
|  | ||
| # Fortran install | ||
| RUN apt install gfortran-10 -y | ||
|  | ||
| RUN \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| gfortran-10 \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # crystal | ||
| RUN curl -sSL https://dist.crystal-lang.org/apt/setup.sh | bash && \ | ||
| apt install crystal -y | ||
| RUN \ | ||
| curl -sSL https://dist.crystal-lang.org/apt/setup.sh | bash \ | ||
| && apt-get update && apt-get install -y --no-install-recommends \ | ||
| crystal \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| # Perl install | ||
| RUN wget https://www.cpan.org/src/5.0/perl-5.32.0.tar.gz && \ | ||
| tar -xzf perl-5.32.0.tar.gz && \ | ||
| cd perl-5.32.0 && \ | ||
| ./Configure -Dprefix=$HOME/perl -Dscriptdir=$HOME/perl/bin -des -Dman1dir=none -Dman3dir=none -DDEBUGGING=-g && \ | ||
| make --jobs=8 install | ||
| RUN \ | ||
| curl -OL https://www.cpan.org/src/5.0/perl-5.32.0.tar.gz \ | ||
| && tar -xzf perl-5.32.0.tar.gz && cd perl-5.32.0 \ | ||
| && ./Configure -Dprefix="/root/perl" -Dscriptdir="/root/perl/bin" -des -Dman1dir=none -Dman3dir=none -DDEBUGGING=-g \ | ||
| && make --jobs=8 install \ | ||
| && rm ../perl-5.32.0.tar.gz | ||
|  | ||
| # install external libraries | ||
| RUN \ | ||
| wget https://raw.githubusercontent.com/MikeMirzayanov/testlib/master/testlib.h && \ | ||
| wget https://github.com/atcoder/ac-library/releases/download/v1.0/ac-library.zip && unzip ac-library.zip | ||
| curl -OL https://raw.githubusercontent.com/MikeMirzayanov/testlib/master/testlib.h \ | ||
| && curl -OL https://github.com/atcoder/ac-library/releases/download/v1.0/ac-library.zip \ | ||
| && unzip ac-library.zip \ | ||
| && rm ac-library.zip | ||
|  | ||
| RUN \ | ||
| apt install libcap-dev && \ | ||
| git clone https://github.com/ioi/isolate.git /isolate | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| libcap-dev \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* \ | ||
| && git clone https://github.com/ioi/isolate.git /isolate | ||
| COPY ./default.cf /isolate/default.cf | ||
| RUN cd /isolate && make install | ||
|  | ||
| RUN apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|  | ||
| ENV DOWNLOAD_ROOT=/download | ||
| ENV DOTNET_ROOT=$HOME/dotnet | ||
| ENV PATH $PATH:$HOME/dotnet | ||
| ENV PATH $PATH:/usr/local/go/bin | ||
| ENV PATH $PATH:$HOME/.cargo/bin | ||
| ENV PATH $PATH:/root/.nimble/bin | ||
| ENV PATH $PATH:$HOME/.rbenv/bin | ||
| ENV PATH $PATH:/root/.sdkman/candidates/kotlin/current/bin | ||
|  | ||
| RUN mkdir /judge | ||
| RUN mkdir /download | ||
| RUN mkdir /box | ||
| RUN mv /rust_workspace /judge | ||
| RUN mkdir -p /judge/Main && chmod -R 777 /judge | ||
| RUN chmod 777 /root | ||
| RUN cp /testlib.h /judge/testlib.h | ||
|  | ||
| #RUN mkdir -p /cafecoder-docker-rust/src | ||
| #COPY dummy.rs /cafecoder-docker-rust/src/main.rs | ||
| #COPY Cargo.toml /cafecoder-docker-rust | ||
| #COPY Cargo.lock /cafecoder-docker-rust | ||
| #COPY .env /cafecoder-docker-rust | ||
| #COPY service-account-cafecoder.json /cafecoder-docker-rust | ||
| #COPY default.cf /cafecoder-docker-rust | ||
| #COPY service-account-cafecoder.json /cafecoder-docker-rust | ||
| #RUN cd cafecoder-docker-rust && source $HOME/.cargo/env && cargo build --release | ||
|  | ||
| #COPY src/ /cafecoder-docker-rust/src | ||
| COPY . /cafecoder-docker-rust | ||
| RUN cd cafecoder-docker-rust && \ | ||
| source $HOME/.cargo/env && \ | ||
| cargo build --release && \ | ||
| cp target/release/cafecoder-docker-rs / && \ | ||
| cp .env / && \ | ||
| cp service-account-cafecoder.json / && \ | ||
| cp default.cf / && \ | ||
| mkdir /temp | ||
|  | ||
| WORKDIR / | ||
|  | ||
| RUN source $HOME/.profile && dotnet -v ; exit 0 | ||
|  | ||
| ENTRYPOINT ["./cafecoder-docker-rs"] | ||
|  | ||
| RUN \ | ||
| mkdir /download \ | ||
| && mkdir /box \ | ||
| && mkdir -p /judge/Main && chmod -R 777 /judge \ | ||
| && chmod 777 /root \ | ||
| && cp /testlib.h /judge/testlib.h | ||
|  | ||
| WORKDIR / | ||
| COPY --from=build /work/target/release/cafecoder-docker-rs app | ||
| COPY --from=build /work/.env .env | ||
| COPY --from=build /work/default.cf default.cf | ||
| COPY --from=build /work/service-account-cafecoder.json service-account-cafecoder.json | ||
|  | ||
| RUN \ | ||
| dotnet -v ; exit 0 | ||
|  | ||
| ENTRYPOINT ["./app"] | ||
  
    
      This file contains hidden or 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 hidden or 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 hidden or 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
    
  
  
    
              
            File renamed without changes.
          
    
            File renamed without changes.
          
    
            File renamed without changes.
          
    
            File renamed without changes.
          
    
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これだと ruby コマンドが使えない><