Skip to content

Commit

Permalink
Uso de alpine como imagen base #61
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroMFC committed Nov 19, 2020
1 parent e7e2e1f commit 92772fe
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contenedor para ejecutar los tests tomando com base Alpine
# Es necesario instalar Task (y entre eso curl para descargarlo) y el lenguaje GO

FROM alpine:latest
LABEL maintainer="Pedro Flores <pedro_23_96@hotmail.com>"
LABEL version="0.0.1"

# Descargamos Go, Task y curl (luego lo borramos porque no hace falta)
# La instalación es necesaria hacerla como root
RUN apk --no-cache add curl go \
&& sh -c "$(curl -ssL https://taskfile.dev/install.sh)" -- -d \
&& apk del curl

# Añadimos el nuevo usuario que será el que ejecute los tests
RUN adduser -D evaluaugr \
&& addgroup -S evaluaugr evaluaugr

# Variables de entorno necearias para el lenguaje
ENV PATH=$PATH:/go/bin:/usr/local/go/bin \
GOPATH=/home/evaluaugr/go \
GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64

# Cambiamos al nuevo usuario e incluimos el directorio de trabajo donde vamos a empezar
USER evaluaugr
WORKDIR /app/test

# Comando a ejecutar cuando se ejecute el contenedor
CMD ["task", "test"]

0 comments on commit 92772fe

Please sign in to comment.