본문 바로가기

리눅스

[리눅스] Simple HTTP File Upload Server

728x90

Simple HTTP File Upload Server

docker-compose 파일 생성

vim docker-compose.yml
version: '3'
services:
  upload-server:
    image: julienmeerschart/simple-file-upload-download-server
    container_name: upload-server
    hostname: upload-server
    restart: unless-stopped
    environment:
       SERVER: "http://fb.sangchul.kr"
    volumes:
      - ./result:/tmp
    expose:
      - 3000/tcp
    ports:
      - 3000:3000

도커 컨테니어 시작

docker-compose up -d

도커 컨테니어 확인

docker-compose ps
$ docker-compose ps
    Name                   Command               State           Ports
-------------------------------------------------------------------------------
upload-server   node /file/server.js 3000 /tmp   Up      0.0.0.0:3000->3000/tcp

파일 업로드(file upload)

echo 'Hello, world!' > sample.txt
curl http://fb.sangchul.kr:3000 -F file=@sample.txt
$ curl http://fb.sangchul.kr:3000 -F file=@sample.txt
{"downloadLink":"http://fb.sangchul.kr:3000/file?file=sample.txt","curl":"curl http://fb.sangchul.kr:3000/file?file=sample.txt > sample.txt"}

 

- 참고사이트

dockerhub : https://hub.docker.com/r/julienmeerschart/simple-file-upload-download-server

 

728x90