728x90
반응형
아래 2개 파일을 만들어야 한다, 도커는 기본 설치되어있어야 함
- docker-compose.yml
- Dockerfile
# docker-compose.yml
name: rust
services:
backend:
build: .
stdin_open: true
tty: true
volumes:
- .:/app # 현재폴더와 컨테이너의 /app과 mount
# Dockerfile
FROM debian:buster-slim
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.68.2
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
wget \
zsh \
curl \
git \
vim \
; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='bb31eaf643926b2ee9f4d8d6fc0e2835e03c0a60f34d324048aa194f0b29a71c' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='6626b90205d7fe7058754c8e993b7efd91dedc6833a11a225b296b7c2941194f' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='4ccaa7de6b8be1569f6b764acc28e84f5eca342f5162cd5c810891bff7ed7f74' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='34392b53a25c56435b411d3e575b63aab962034dd1409ba405e708610c829607' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.25.2/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
apt-get remove -y --auto-remove \
wget \
; \
rm -rf /var/lib/apt/lists/*;
$ docker compose up
...
Attaching to rust-backend-1
$ docker exec -it rust-backend-1 /bin/bash
2023.04.05 - [Programming/Python] - docker compose - python default 컨테이너 만들기
728x90
728x90
BIG
'Programming > Rust' 카테고리의 다른 글
Rust 간단한 웹서버 HttpServer 올리기 (0) | 2023.04.19 |
---|---|
Rust 의 await, Future, Poll 에 대해 (2) | 2023.03.24 |
Rust match (0) | 2023.03.16 |
Rust 매크로 macro_rules! (0) | 2023.03.15 |
Rust trait - 인터페이스?, 추상클래스? (0) | 2023.03.14 |
댓글