I dockerized my play app but I keep getting error sbt already exists but there is not sbt. I Just want it to download, extract and push it to bin.
Dockerfile
<code># Use an official OpenJDK runtime as a parent image
FROM openjdk:17-jdk-alpine
# Set the working directory in the container
WORKDIR /app
# Copy the application code to the container
COPY . /app
# Install sbt
RUN apk add --no-cache bash curl &&
curl -L -o /usr/local/bin/sbt https://github.com/sbt/sbt/releases/download/v1.4.7/sbt-1.4.7.tgz &&
tar xzf /usr/local/bin/sbt -C /usr/local/bin &&
chmod +x /usr/local/bin/sbt
# Build the application
RUN sbt compile stage
# Expose the port that the Play app runs on
EXPOSE 9000
# Define the command to run the application
CMD ["sbt", "run"]
</code>
<code># Use an official OpenJDK runtime as a parent image
FROM openjdk:17-jdk-alpine
# Set the working directory in the container
WORKDIR /app
# Copy the application code to the container
COPY . /app
# Install sbt
RUN apk add --no-cache bash curl &&
curl -L -o /usr/local/bin/sbt https://github.com/sbt/sbt/releases/download/v1.4.7/sbt-1.4.7.tgz &&
tar xzf /usr/local/bin/sbt -C /usr/local/bin &&
chmod +x /usr/local/bin/sbt
# Build the application
RUN sbt compile stage
# Expose the port that the Play app runs on
EXPOSE 9000
# Define the command to run the application
CMD ["sbt", "run"]
</code>
# Use an official OpenJDK runtime as a parent image
FROM openjdk:17-jdk-alpine
# Set the working directory in the container
WORKDIR /app
# Copy the application code to the container
COPY . /app
# Install sbt
RUN apk add --no-cache bash curl &&
curl -L -o /usr/local/bin/sbt https://github.com/sbt/sbt/releases/download/v1.4.7/sbt-1.4.7.tgz &&
tar xzf /usr/local/bin/sbt -C /usr/local/bin &&
chmod +x /usr/local/bin/sbt
# Build the application
RUN sbt compile stage
# Expose the port that the Play app runs on
EXPOSE 9000
# Define the command to run the application
CMD ["sbt", "run"]
Error
<code>10.87 tar: can't create directory 'sbt': File exists
10.87 tar: can't remove old file sbt/LICENSE: Not a directory
------
Dockerfile:11
--------------------
10 | # Install sbt
11 | >>> RUN apk add --no-cache bash curl &&
12 | >>> curl -L -o /usr/local/bin/sbt https://github.com/sbt/sbt/releases/download/v1.4.7/sbt-1.4.7.tgz &&
13 | >>> tar xzf /usr/local/bin/sbt -C /usr/local/bin &&
14 | >>> chmod +x /usr/local/bin/sbt
</code>
<code>10.87 tar: can't create directory 'sbt': File exists
10.87 tar: can't remove old file sbt/LICENSE: Not a directory
------
Dockerfile:11
--------------------
10 | # Install sbt
11 | >>> RUN apk add --no-cache bash curl &&
12 | >>> curl -L -o /usr/local/bin/sbt https://github.com/sbt/sbt/releases/download/v1.4.7/sbt-1.4.7.tgz &&
13 | >>> tar xzf /usr/local/bin/sbt -C /usr/local/bin &&
14 | >>> chmod +x /usr/local/bin/sbt
</code>
10.87 tar: can't create directory 'sbt': File exists
10.87 tar: can't remove old file sbt/LICENSE: Not a directory
------
Dockerfile:11
--------------------
10 | # Install sbt
11 | >>> RUN apk add --no-cache bash curl &&
12 | >>> curl -L -o /usr/local/bin/sbt https://github.com/sbt/sbt/releases/download/v1.4.7/sbt-1.4.7.tgz &&
13 | >>> tar xzf /usr/local/bin/sbt -C /usr/local/bin &&
14 | >>> chmod +x /usr/local/bin/sbt