-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from a5chin/feature/docker
Refactor Docker
- Loading branch information
Showing
6 changed files
with
38 additions
and
125 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,29 +1,11 @@ | ||
FROM debian:bookworm-slim AS builder | ||
ARG UV_VERSION=0.5.4 | ||
ARG DEBIAN_VERSION=bookworm | ||
|
||
ENV CARGO_HOME="/opt/.cargo" | ||
|
||
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ] | ||
FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv | ||
|
||
WORKDIR /opt | ||
|
||
# The installer requires curl (and certificates) to download the release archive | ||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends ca-certificates curl | ||
|
||
# Run uv installer | ||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh | ||
|
||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/base:$DEBIAN_VERSION | ||
LABEL maintainer="a5chin <[email protected]>" | ||
|
||
ENV CARGO_HOME="/opt/.cargo" | ||
ENV PATH="$CARGO_HOME/bin/:$PATH" | ||
ENV PYTHONUNBUFFERED=True | ||
ENV UV_LINK_MODE=copy | ||
|
||
WORKDIR /opt | ||
|
||
COPY --from=builder --chown=vscode: $CARGO_HOME $CARGO_HOME | ||
COPY --from=uv --chown=vscode: /uv /uvx /bin/ |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -31,18 +31,6 @@ jobs: | |
with: | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
lint-devcontainer-with-rust: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Lint Dockerfile | ||
uses: hadolint/[email protected] | ||
with: | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
|
@@ -88,26 +76,3 @@ jobs: | |
tags: latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
build-devcontainer-with-rust: | ||
runs-on: ubuntu-latest | ||
|
||
needs: lint-devcontainer-with-rust | ||
if: ${{ success() }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: .devcontainer/buildWithRust.Dockerfile | ||
push: false | ||
tags: latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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 |
---|---|---|
@@ -1,24 +1,21 @@ | ||
ARG DEBIAN_VERSION=bookworm | ||
ARG UV_VERSION=0.5.4 | ||
ARG VARIANT=3.12 | ||
|
||
FROM python:${VARIANT} AS builder | ||
|
||
ENV PYTHONDONTWRITEBYTECODE=True | ||
ENV UV_LINK_MODE=copy | ||
|
||
WORKDIR /opt | ||
FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv | ||
|
||
COPY pyproject.toml uv.lock ./ | ||
|
||
# hadolint ignore=DL3013,DL3042 | ||
RUN pip install --upgrade pip && \ | ||
pip install uv && \ | ||
uv sync --frozen | ||
|
||
FROM python:$VARIANT-slim-$DEBIAN_VERSION | ||
LABEL maintainer="a5chin <[email protected]>" | ||
|
||
FROM python:${VARIANT}-slim | ||
ENV PYTHONDONTWRITEBYTECODE=True | ||
ENV PYTHONUNBUFFERED=True | ||
ENV UV_LINK_MODE=copy | ||
|
||
LABEL maintainer="a5chin <[email protected]>" | ||
WORKDIR /app | ||
|
||
COPY --from=builder /usr/local/lib/python*/site-packages /usr/local/lib/python*/site-packages | ||
COPY --from=uv /uv /uvx /bin/ | ||
COPY pyproject.toml uv.lock ./ | ||
|
||
ENV PYTHONUNBUFFERED=True | ||
RUN uv sync --frozen --no-install-project |