Skip to content

Commit

Permalink
Another try to fix Dockerfile (#2621)
Browse files Browse the repository at this point in the history
- added arg for BASE_IMAGE
- fixed detektAll
  • Loading branch information
nulls authored Sep 27, 2023
1 parent 2658203 commit 948f669
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-base-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
# https://github.com/marketplace/actions/build-and-push-docker-images#inputs
# '`List` type is a newline-delimited string'
build-args: |
BASE_IMAGE=${{ matrix.base_image_name }}:${{ matrix.base_image_tag }}
BASE_IMAGE_NAME=${{ matrix.base_image_name }}
BASE_IMAGE_TAG=${{ matrix.base_image_tag }}
tags: ghcr.io/saveourtool/save-base:${{ matrix.base_image_name }}-${{ env.FORMATTED_TAG }}

build_custom_builder_image:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import okio.use

import kotlinx.coroutines.*
import kotlinx.datetime.Clock
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.modules.SerializersModule
import kotlinx.serialization.modules.polymorphic
Expand Down Expand Up @@ -90,7 +89,6 @@ class SaveAgent(

// a temporary workaround for python integration
private fun executeAdditionallySetup(
targetDirectory: Path,
additionalFileNames: Collection<String>,
setupShTimeoutMillis: Long,
) = runCatching {
Expand Down Expand Up @@ -210,7 +208,7 @@ class SaveAgent(
}

// a temporary workaround for python integration
executeAdditionallySetup(targetDirectory, agentInitConfig.additionalFileNameToUrl.keys, agentInitConfig.setupShTimeoutMillis)
executeAdditionallySetup(agentInitConfig.additionalFileNameToUrl.keys, agentInitConfig.setupShTimeoutMillis)
.runIf(
failureResultPredicate
) {
Expand Down
17 changes: 11 additions & 6 deletions save-deploy/base-images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
ARG BASE_IMAGE

FROM $BASE_IMAGE

ARG BASE_IMAGE_NAME
ARG BASE_IMAGE_TAG
FROM $BASE_IMAGE_NAME:$BASE_IMAGE_TAG

RUN apt-get update && env DEBIAN_FRONTEND="noninteractive" apt-get install -y curl libcurl4-openssl-dev tzdata unzip
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y curl libcurl4-openssl-dev tzdata unzip
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime
RUN rm -rf /var/lib/apt/lists/*

# clang-12 can only be installed to ubuntu and is only needed for GSAC contest
RUN if [[ "$BASE_IMAGE_NAME" == "ubuntu" ]]; then \
apt-get update && env DEBIAN_FRONTEND="noninteractive" apt-get install -y clang-12 clang-format libclang-12-dev; \
RUN if [ "$BASE_IMAGE_NAME" = "ubuntu" ]; then \
apt-get install -y clang-12 clang-format libclang-12-dev; \
fi

# Fixme: https://github.com/saveourtool/save-cloud/issues/352
Expand All @@ -18,6 +21,8 @@ RUN if [[ "$BASE_IMAGE_NAME" == "python" ]]; then \
ln -s $(which java) /usr/bin/java; \
fi

RUN rm -rf /var/lib/apt/lists/*

RUN groupadd --gid 1100 save-agent && \
useradd --uid 1100 --gid 1100 --create-home --shell /bin/sh save-agent && \
# `WORKDIR` directive creates the directory as `root` user unless the directory already exists
Expand Down

0 comments on commit 948f669

Please sign in to comment.