added back test hello world
This commit is contained in:
@@ -8,6 +8,13 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
# ---------------------------------
|
||||||
|
# test:
|
||||||
|
# build:
|
||||||
|
# context: ./requirements/test
|
||||||
|
# dockerfile: Dockerfile
|
||||||
|
# image: test
|
||||||
|
# container_name: test_container
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
nginx:
|
nginx:
|
||||||
#restart: on-failure
|
#restart: on-failure
|
||||||
|
|||||||
0
srcs/requirements/test/.dockerignore
Normal file
0
srcs/requirements/test/.dockerignore
Normal file
47
srcs/requirements/test/Dockerfile
Normal file
47
srcs/requirements/test/Dockerfile
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
# basic test
|
||||||
|
# build with : sudo docker build --tag test .
|
||||||
|
# run with : sudo docker run test
|
||||||
|
# 'hello' in assembly found here : http://timelessname.com/elfbin/
|
||||||
|
FROM scratch
|
||||||
|
COPY tools/hello /
|
||||||
|
CMD [ "/hello" ]
|
||||||
|
|
||||||
|
## working
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR /
|
||||||
|
#COPY hello /
|
||||||
|
#CMD [ "/hello" ]
|
||||||
|
|
||||||
|
## working, when WORKDIR is absent, it's default is set to "/"
|
||||||
|
#FROM scratch
|
||||||
|
#COPY hello /
|
||||||
|
#CMD [ "/hello" ]
|
||||||
|
|
||||||
|
## not working, when CMD execute in shell form, instead of exec form []
|
||||||
|
#FROM scratch
|
||||||
|
#COPY hello /
|
||||||
|
#CMD /hello
|
||||||
|
|
||||||
|
## not working, because c executable need library <unistd.h>
|
||||||
|
#FROM scratch
|
||||||
|
#COPY hello_c /
|
||||||
|
#CMD [ "/hello_c" ]
|
||||||
|
|
||||||
|
## not working, when executable is copied to ".", because WORKDIR value is not "." but "/" since we gave it a relativ path so it was build in top of the implicit absolut path "/"
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR .
|
||||||
|
#COPY hello .
|
||||||
|
#CMD [ "hello" ]
|
||||||
|
|
||||||
|
## not working, when WORKDIR is set to the present directory and executable is not copied, because the workdir is not the present directory but a directory in the file system of docker : executable need to be copied there to function
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR /home/simplonco/Desktop/42/14_inception/inception/srcs/requirements/mariadb
|
||||||
|
#CMD [ "hello" ]
|
||||||
|
|
||||||
|
## working, because "hello" is copied to "/" and execute from "/"
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR .
|
||||||
|
#COPY hello /
|
||||||
|
#CMD [ "/hello" ]
|
||||||
|
|
||||||
BIN
srcs/requirements/test/tools/hello
Executable file
BIN
srcs/requirements/test/tools/hello
Executable file
Binary file not shown.
16
srcs/requirements/test/tools/hello.asm
Normal file
16
srcs/requirements/test/tools/hello.asm
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
SECTION .data
|
||||||
|
msg: db "Hi World",10
|
||||||
|
len: equ $-msg
|
||||||
|
|
||||||
|
SECTION .text
|
||||||
|
global main
|
||||||
|
main:
|
||||||
|
mov edx,len
|
||||||
|
mov ecx,msg
|
||||||
|
mov ebx,1
|
||||||
|
mov eax,4
|
||||||
|
int 0x80
|
||||||
|
mov ebx,0
|
||||||
|
mov eax,1
|
||||||
|
int 0x80
|
||||||
|
|
||||||
Reference in New Issue
Block a user