-
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.
- Loading branch information
0 parents
commit 405f791
Showing
3 changed files
with
97 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build Elixir devcontainer image | ||
|
||
on: | ||
push: | ||
|
||
env: | ||
DOCKER_REGISTRY: ghcr.io | ||
DOCKER_USERNAME: ${{ github.actor }} | ||
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
IMAGE_NAME: ghcr.io/blockscout/devcontainer-elixir | ||
|
||
jobs: | ||
build-elixir: | ||
name: Docker image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.DOCKER_REGISTRY }} | ||
username: ${{ env.DOCKER_USERNAME }} | ||
password: ${{ env.DOCKER_PASSWORD }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
file: ./Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha |
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,51 @@ | ||
ARG VARIANT="1.17.3-erlang-27.1-debian-bullseye-20240926" | ||
ARG PHOENIX_VERSION="1.7.10" | ||
ARG NODE_VERSION="18" | ||
FROM hexpm/elixir:${VARIANT} | ||
|
||
# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in | ||
# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user. | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Options for common package install script | ||
ARG INSTALL_ZSH="true" | ||
ARG UPGRADE_PACKAGES="true" | ||
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/common-debian.sh" | ||
ARG COMMON_SCRIPT_SHA="dev-mode" | ||
|
||
# [Optional] Setup nodejs | ||
ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/node-debian.sh" | ||
ARG NODE_SCRIPT_SHA="dev-mode" | ||
ENV NVM_DIR=/usr/local/share/nvm | ||
ENV NVM_SYMLINK_CURRENT=true | ||
ENV PATH=${NVM_DIR}/current/bin:${PATH} | ||
|
||
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. | ||
RUN apt-get update \ | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ | ||
&& curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ | ||
&& ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \ | ||
&& /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ | ||
# | ||
# [Optional] Install Node.js for use with web applications | ||
&& if [ "$NODE_VERSION" != "none" ]; then \ | ||
curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \ | ||
&& ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${NODE_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \ | ||
&& /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \ | ||
&& npm install -g cspell@latest; \ | ||
fi \ | ||
# | ||
# Install dependencies | ||
&& apt-get install -y build-essential inotify-tools \ | ||
# | ||
# Clean up | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/common-setup.sh /tmp/node-setup.sh | ||
|
||
RUN su ${USERNAME} -c "mix local.hex --force \ | ||
&& mix local.rebar --force \ | ||
&& mix archive.install --force hex phx_new ${PHOENIX_VERSION}" |
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,4 @@ | ||
Elixir based devcontainer image | ||
---- | ||
|
||
This repo contains the docker file to build a docker image that can be used as a base for VSCode devcontainers. |