Skip to content

Commit c3b8817

Browse files
committed
docs(SRV): update
1 parent dff50fe commit c3b8817

File tree

2 files changed

+78
-2
lines changed

2 files changed

+78
-2
lines changed

pages/serverless-containers/how-to/build-push-container-image.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ content:
77
paragraph: Learn how to create a Dockerfile to containerize your applications for deployment on Scaleway or any other containerized platform.
88
tags: create dockerfile containerize application deployment scaleway
99
dates:
10-
validation: 2025-02-25
11-
posted: 2021-05-26
10+
validation: 2025-04-02
11+
posted: 2021-04-02
1212
categories:
1313
- serverless
1414
- containers
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
meta:
3+
title: How to create a Dockerfile
4+
description: Learn how to create a Dockerfile for deploying containerized applications.
5+
content:
6+
h1: How to create a Dockerfile
7+
paragraph: Learn how to create a Dockerfile to containerize your applications for deployment on Scaleway or any other containerized platform.
8+
tags: create dockerfile containerize application deployment scaleway
9+
dates:
10+
validation: 2025-04-02
11+
posted: 2021-04-01
12+
categories:
13+
- serverless
14+
- jobs
15+
---
16+
17+
This page explains how to create a simple Dockerfile to containerize your applications for deployment using Scaleway Serverless Jobs.
18+
19+
## How to Write a Dockerfile
20+
21+
1. Create a file named `Dockerfile` in your project directory.
22+
23+
2. Add the following content to your Dockerfile, adjusting the base image and commands according to your application:
24+
25+
```dockerfile
26+
# Use an official base image
27+
FROM python:3.9-slim
28+
29+
# Set the working directory in the container
30+
WORKDIR /app
31+
32+
# Copy the current directory contents into the container at /app
33+
COPY . /app
34+
35+
# Install any needed packages specified in requirements.txt
36+
RUN pip install --no-cache-dir -r requirements.txt
37+
38+
# Make port 80 available to the world outside this container
39+
EXPOSE 80
40+
41+
# Define environment variable
42+
ENV NAME World
43+
44+
# Run app.py when the container launches
45+
CMD ["python", "app.py"]
46+
```
47+
48+
## How to build and push your image from your dockerfile
49+
50+
1. Open a terminal and navigate to the directory containing your Dockerfile.
51+
52+
2. Run the following command to build your Docker image:
53+
54+
```bash
55+
docker build -t my-application .
56+
```
57+
58+
3. Log in to your Scaleway account in the terminal:
59+
60+
```
61+
docker login -u <your-email> --password-stdin
62+
```
63+
64+
4. Tag your Docker image so it matches your Scaleway registry's format:
65+
66+
```
67+
docker tag my-application
68+
```
69+
70+
5. Push the Docker image to the Scaleway Container Registry:
71+
72+
```
73+
docker push
74+
```
75+
76+
You can now access your container image from the [Scaleway Container Registry](https://console.scaleway.com/)

0 commit comments

Comments
 (0)